fancyBox ======== fancyBox is a tool that offers a nice and elegant way to add zooming functionality for images, html content and multi-media on your webpages. More information and examples: http://www.fancyapps.com/fancybox/ License: http://www.fancyapps.com/fancybox/#license Copyright (c) 2011 Janis Skarnelis - janis@fancyapps.com How to use ---------- To get started, download the plugin, unzip it and copy files to your website/application directory. Load files in the
section of your HTML document. Make sure you also add the jQuery library. Create your links with a `title` if you want a title to be shown, and add a class:
If you have a set of related items that you would like to group,
additionally include a group name in the `rel` (or `data-fancybox-group`) attribute:
Initialise the script like this:
Script uses the `href` attribute of the matched elements to obtain the location of the content and to figure out content type you want to display. You can specify type directly by adding classname (fancybox.image, fancybox.iframe, etc).
Ajax:
Example
Iframe:
Example
Inline:
Example
SWF:
Example
Image:
Example
Note, ajax requests are subject to the [same origin policy](http://en.wikipedia.org/wiki/Same_origin_policy).
Advanced
--------
### Helpers
Helpers provide a simple mechanism to extend the capabilities of fancyBox.
There ar two built-in helpers - 'overlay' and 'title'. You can disable them or set custom options:
Disable 'overlay' helper and change title location:
$(".fancybox").fancybox({
helpers: {
overlay : null,
title: {
type : 'inside'
}
}
});
### API
Also available are event driven callback methods. The `this` keyword refers to the curent or upcoming object (depends on callback method). Here is how you can change title:
$(".fancybox").fancybox({
afterLoad : function() {
this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : '');
}
});
It`s possible to open fancyBox programmatically in various ways:
HTML content:
$.fancybox( 'Lorem lipsum