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.

[ 199 ]<br />

Chapter 7<br />

We then set the href <strong>of</strong> the current link to a document fragment identifier pointing to the<br />

name <strong>of</strong> the corresponding content section. This wouldn't have any effect if we weren't<br />

intercepting clicks on the nav links because the content sections don't have matching id<br />

attributes, but it is necessary to store the fragment here so that we can read it back when<br />

the link is clicked.<br />

Lastly, we check again whether we're processing the last link or not, and if we are, we trigger<br />

our custom contentLoaded event, which results in the page's element being appended to<br />

the page, and the click handlers bound to the navigation links.<br />

Building a site like this which pulls all <strong>of</strong> its content into a single page won't suit every type <strong>of</strong><br />

site. Most clients would probably pay the cancellation fees and swiftly withdraw if this idea<br />

was presented to them. However, on highly stylized sites, where the design and behavior <strong>of</strong><br />

the site is <strong>of</strong> special importance, this kind <strong>of</strong> effect can work well. Sites with little content on<br />

each page are especially suited to it.<br />

The following screenshot shows the functionality in action:<br />

In the previous screenshot, we can see the header and footer partly faded out, and the page<br />

content being scrolled diagonally downwards to the right.

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

Saved successfully!

Ooh no, something went wrong!