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.

[ 249 ]<br />

Chapter 9<br />

<br />

<br />

<br />

<br />

Left<br />

Right<br />

<br />

<br />

2. Save the page as skew.html. Next in a new file add the following code:<br />

#viewer {<br />

width:700px; height:220px; padding:100px 0 30px; margin:auto;<br />

border:1px solid #000; position:relative;<br />

}<br />

#flow:after {<br />

content:""; display:block; height:0; clear:both;<br />

visibility:hidden;<br />

}<br />

#flow img {<br />

display:block; margin-left:-165px; position:relative; top:-15px;<br />

left:245px; float:left; background-color:#fff;<br />

}<br />

#viewer li { list-style-type:none; position:absolute; bottom:10px;<br />

}<br />

#left { left:20px; }<br />

#right { right:20px; }<br />

3. Save this file in the css directory as skew.css.<br />

What just happened?<br />

We're using a simple collection <strong>of</strong> elements for this example. We use an outer container,<br />

mostly for positioning purposes so that we can center the widget in the viewport and<br />

position other elements within it.<br />

The elements are what we will be applying the skew animations to, so these are<br />

isolated in their own container to make selecting them in the script later on easier. We<br />

also have a list element containing two links. These will be used to trigger the animations.<br />

The CSS is as light as the HTML. We simply position the container, the images, and the<br />

controls as required for the example. All <strong>of</strong> the fun CSS3 we'll set and manipulate using<br />

the script. You should note that this example isn't progressively-enhanced as this would<br />

deviate too far from an already quite large example, as we'll see in a moment when we<br />

add the JavaScript.

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

Saved successfully!

Ooh no, something went wrong!