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.

• Border color around pop-up images. Normally, FancyBox displays a white<br />

border around a pop-up image. As mentioned in the previous section, you can<br />

control the size of that border by sending a padding value to the FancyBox function.<br />

However, to control its color, you need to edit the FancyBox style sheet.<br />

Locate the style #fancybox-content and change its border color from #FFF to<br />

whatever color you prefer.<br />

• Color behind photos. When you create a gallery effect where a visitor can click<br />

the previous and next buttons to jump from large image to large image, Fancy-<br />

Box displays a background color as one image fades out and the next fades in.<br />

This color is defined by the background property in the #fancybox-outer style.<br />

It’s a good idea to have this value match whatever color you define for the border<br />

color (previous bullet point).<br />

• Captions. You can control the color, font, and size of captions by editing various<br />

CSS Styles. <strong>The</strong> #fancybox-title style defines the font and font size of the caption,<br />

while the .fancybox-title-inside, .fancybox-title-outside, and .fancyboxtitle-over<br />

styles affect the look of the caption based on its titlePosition setting<br />

(discussed on page 228). For example, if you set the “titlePosition” option to<br />

inside, the caption appears inside the border for the image. If you change the<br />

border color (see above bullet point), then you should change the background<br />

property on the .fancybox-title-inside style to match that border color. If you<br />

don’t set the titlePosition option, FancyBox uses images inside the fancybox.png<br />

file to generate a graphical caption box. It takes three slices of that image (one for<br />

the left edge of the box, another for the middle section of the box, and a third for<br />

the right edge of the box). To alter the images used, you can edit the following<br />

styles: #fancybox-title-float-left, #fancybox-title-float-main, and #fancybox-titlefloat-right.<br />

Tip: FancyBox lets you customize the HTML used to display the captions in many different ways by creating<br />

a custom function. You can find out how and see more tips and tricks for using FancyBox at<br />

http://fancybox.net/blog.<br />

Tutorial: FancyBox Photo Gallery<br />

Although FancyBox is really easy to use, it’s always helpful to have a step-by-step<br />

tutorial showing you how it’s done. In this tutorial, you’ll take a page with a basic set<br />

of thumbnail images and turn it into a fancy pop-up gallery.<br />

Note: See the note on page 29 for information on how to download the tutorial files.<br />

www.it-ebooks.info<br />

chapter 7: improving your images<br />

Tutorial: FancyBox<br />

Photo Gallery<br />

231

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

Saved successfully!

Ooh no, something went wrong!