02.06.2013 Views

jQuery 1.4 Animation Techniques - Index of

jQuery 1.4 Animation Techniques - Index of

jQuery 1.4 Animation Techniques - Index of

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Extended <strong>Animation</strong>s with <strong>jQuery</strong> UI<br />

Configuration options<br />

The blind effect has the following configuration options:<br />

Option Default Usage<br />

direction "vertical" Sets the axis along which the target element is shown or<br />

hidden.<br />

mode "hide" Sets whether the element is shown or hidden when used with<br />

the effect() method. Other possible values include show,<br />

toggle, and effect.<br />

Time for action – using the blind effect<br />

I mentioned earlier that the effect is reminiscent <strong>of</strong> a window blind rolling up or down, so<br />

let's base our next example on that:<br />

1. In the <strong>of</strong> the template file add the following code:<br />

<br />

<br />

<br />

2. Implement the effect with the following script:<br />

$("#window").click(function() {<br />

$("#blind").toggle("blind");<br />

});<br />

3. Save this file as blind.html. The stylesheet for this example is as follows:<br />

#window {<br />

width:464px; height:429px; position:relative; cursor:pointer;<br />

background:url(../img/window.jpg) no-repeat 0 0;<br />

}<br />

#blind {<br />

display:none; width:332px; height:245px; position:absolute;<br />

left:64px; top:113px;<br />

background:url(../img/blind.png) no-repeat 0 100%;<br />

}<br />

4. Save this as blind.css in the css folder.<br />

5. When we run the page in a browser, the blind should alternately roll down and up<br />

each time the window is clicked:<br />

[ 156 ]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!