Spry Blind Effect Samples

This page will demonstrate the Spry Blind Effect capabilities.


The default Blind effect behavior will Blind Out the target element from the initial size until the element disappears, in 1 second.


Example 1

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.


After beginning, the blind effect can be called in different situations, by different elements in the page, at different moments. This example will demonstrate how to animate the same element when you are clicking a button or a link. The animation can be also started when the mouse is over an element, the page is loaded or on any other page events.

In this example, each time the effect is started, it will toggle the direction because we added "toggle:true" to the list of options.

<script type="text/javascript">
	var blind_toggle = new Spry.Effect.Blind('slideItUp2', {toggle:true});
</script>
Blind Example 2

Example 2

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.


The duration and the initial/final size of the animated region can be controled with specific options passed to the Slide Effect constructor. The "from" and "to" options represent the percentage of the initial element size or the absolute value in pixels.

<script type="text/javascript">
 var blind3 = new Spry.Effect.Blind('slideItDown1', {duration: 2000, from: '40px', to: '200px', toggle: true});
</script>

Example 3 - Blind from 40px to 200px in 2 seconds

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

Example 4 - Blind from 100% to 20% in 3 seconds

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.


The target element can initially be hidden. To hide an element you can use one of two CSS properties: display and visibility. The difference between these two properties is the way it will alter the flow of the page. While using the display: none; the element is completelly removed from page and the other elements take its place on the page. The visibility: hidden will leave the element in the page flow but the element is simply not seen.

In the following sample we will use the visibility: none; to initially hide the element and using the Blind effect, the element will appear on the page.

<style type="text/css">
.animationContainer{
	height: 220px;
}
.hideInitially{
	visibility: hidden;
}
</style>
...
<form method="get" action="blinds_sample.html">
	<input type="button" onclick="blind_hidden.start();" value="Blind Example Hidden" />
</form>

<div class="animationContainer">
	<div class="hideInitially" id="slideItDown_hidden">
	...
	</div>
</div>

<script type="text/javascript">
 var blind_hidden = new Spry.Effect.Blind("slideItDown_hidden", {duration: 2000, from: '0%', to: '100%', toggle: true});
</script>

Example - Blind from 0% to 100% in 2 seconds

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

Sometimes when using the effects, you need to run some other JavaScript functions before or after the animation. In the constructor you have the ability to pass two options: "setup" and "finish" with the callback functions which Blind will call automatically.

This example will disable the button while the animation runs. It will re-enable when the effect finishes.

<script type="text/javascript"> var animation_start = function(){
   var button = document.getElementById('animation_button');
   if (button){
   button.disabled = true;
   button.style.backgroundColor = 'white';
   }
   }
    var animation_stop = function(){
   var button = document.getElementById('animation_button');
   if (button){
   button.disabled = false;
   button.style.backgroundColor = '';
   }
   }
    var blind_func = new Spry.Effect.Blind('slideIt', {toggle:true, setup: animation_start, finish: animation_stop});
</script>

Example 5

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.