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.

Other Popular <strong>Animation</strong>s<br />

What just happened?<br />

The underlying HTML represents a typical blog. We've added a series <strong>of</strong> elements for two<br />

reasons, primarily so that we have somewhere to insert the marquee, but also so that we<br />

can see why this approach can be necessary.<br />

Having the latest posts scrolling across the page near the top <strong>of</strong> the site ensures that this<br />

content is seen straight away, and the fact that it's animated also helps to draw the visitor's<br />

attention to it.<br />

The CSS used so far is purely to layout the example elements in a precise and mildly aesthetic<br />

way, giving us a generic layout and a light skinning. We'll add some more CSS a little later in<br />

the example for our dynamically created marquee. At this point, the page should appear<br />

like this:<br />

Remember, all <strong>of</strong> the elements in the previous screenshot are there for the marquee to be<br />

inserted between. They are not specifically required, and are there for this example.<br />

Time for action – retrieving and processing the post list<br />

Now we're ready to retrieve the list <strong>of</strong> latest posts and process them, making them ready to<br />

be displayed as items in the marquee. In order to access this data across the Internet from<br />

another domain, we need to use JSONP, which stands for JSON with Padding, and involves<br />

dynamically creating and injecting a element to the page, although <strong>jQuery</strong><br />

actually handles this aspect <strong>of</strong> it for us.<br />

[ 222 ]

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

Saved successfully!

Ooh no, something went wrong!