02.06.2013 Views

JavaScript & jQuery: The Missing Manual ... - Robert Guajardo

JavaScript & jQuery: The Missing Manual ... - Robert Guajardo

JavaScript & jQuery: The Missing Manual ... - Robert Guajardo

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.

Using AnythingSlider<br />

AnythingSlider requires several files to work: <strong>jQuery</strong> (of course), an external<br />

<strong>JavaScript</strong> file with the slider programming, a CSS file for styling the basic slider<br />

effect, and an image file for the sliders controls (next and previous buttons). You<br />

can download Anything Slider from https://github.com/ProLoser/AnythingSlider/.<br />

(We’ve also included a copy of the necessary files with the tutorial files for this<br />

chapter.) <strong>The</strong> basic process for using the plug-in is straightforward:<br />

1. Attach the anythingslider.css file to your web page.<br />

This external CSS provides formatting instructions for the slider’s navigation<br />

buttons, as well as behind-the-scenes styles for placing the individual slides.<br />

You’ll be able to modify basic elements of the slider by altering styles in this file<br />

(see below).<br />

2. Link to the <strong>jQuery</strong> file.<br />

<strong>jQuery</strong> provides the basic toolset AnythingSlider needs. As when using any<br />

<strong>jQuery</strong> plug-in, you must load the <strong>jQuery</strong> <strong>JavaScript</strong> file first. If you load <strong>jQuery</strong><br />

after the plug-in file loads, it won’t work.<br />

3. Link to the AnythingSlider file.<br />

This file contains the basic programming to transform your HTML into a slider.<br />

4. Add HTML.<br />

AnythingSlider doesn’t require any complex HTML. You only need add a container<br />

div with the ID of slider——and, inside that div, insert<br />

one div for each panel, or “slide.” This is very similar to how panels are set up<br />

with tabbed panels (page 302).<br />

chapter 10: expanding your interface<br />

www.it-ebooks.info<br />

Adding a Content<br />

Slider to Your Site<br />

Figure 10-4:<br />

To minimize on-screen clutter,<br />

sites like Microsoft.com use<br />

content sliders (outlined in<br />

black) to display a single image<br />

or chunk of content at a time.<br />

In this example, the image<br />

outlined can slide out of sight<br />

to the left, revealing another<br />

image with more information.<br />

313

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

Saved successfully!

Ooh no, something went wrong!