Fancybox是一款基于jquery开发的类Lightbox插件。支持对放大的图片添加阴影效果,对于一组相关的图片添加导航操作按纽。
Fancybox 是一款很绚丽的 jquery 弹出层展示插件,该lightbox除了能够展示图片之外,还可以展示iframed内容, 通过css自定义外观。
How to use
1.First, make sure you are using valid DOCTYPE
This is required for FancyBox to look and function correctly.
2.Include necessary JS files
Loading jQuery from CDN (Content Delivery Network) is recommended
|
|
Optional - Add transitions as jQuery by default supports only “swing” and “linear”
|
|
Optional - Enable “mouse-wheel” to navigate throught gallery items
|
|
3.Add FancyBox CSS file
Don`t forget to change background image paths if CSS file is not in the same directory.
Also, check src paths for AlphaImageLoader as they are relative to the HTML document, while regular CSS background images are relative to the CSS document (read more).
|
|
4.Create a link element
Images
|
|
Inline content
|
|
Iframe
|
|
or
|
|
Ajax
|
|
Optional - Use the title attribute for anchors if you want to show a caption
Note - You may want to set hideOnContentClick to false if you display iframed or inline content and it containts clickable elements (for example - play buttons for movies, links to other pages)
5.Fire plugin using jQuery selector
If you are not familiar with jQuery, please, read this tutorial for beginners
Sample examples:
|
|
Note - ID’s are meant for a SINGLE instance. If you want to use the same script for all your images/elements then use classes instead.
Note - Galleries are created from elements who have the same “rel” tag, example:
|
|