bug or function in photo view :fancybox

some fancybox api:

http://blog.csdn.net/china_skag/article/details/23882281

今天给大家介绍的jquery图片播放插件叫Fancybox,相比LightBox来说,Fancybox相对庞大点,配置也更丰富一些,相信你会喜欢的。
Fancybox的项目主页地址:http://fancybox.net/



Fancybox的特点如下:
可以支持图片、html文本、flash动画、iframe以及ajax的支持
可以自定义播放器的CSS样式
可以以组的形式进行播放
如果将鼠标滚动插件(mouse wheel plugin)包含进来的话Fancybox还能支持鼠标滚轮滚动来翻阅图片
Fancybox播放器支持投影,更有立体的感觉


Fancybox使用方法:

1、引入jquery核心库和Fancybox插件库
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/javascript" src="/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
可选 - 如果需要用到fancy transition(一些动画效果)你还需要引入以下脚本
<script type="text/javascript" src="/fancybox/jquery.easing-1.4.pack.js"></script>

可选 - 如果需要支持鼠标滚轮滚动效果你还需要引入以下脚本
<script type="text/javascript" src="/fancybox/jquery.mousewheel-3.0.4.pack.js"></script>


2、添加样式表文件
<link rel="stylesheet" href="/fancybox/jquery.fancybox-1.3.4.css" type="text/css" media="screen">


3、在页面上创建链接元素

A、图片元素
<a id="single_image" href="image_big.jpg"><img src="image_small.jpg" kesrc="image_small.jpg" alt=""></a>

B、普通文本
<a id="inline" href="#data" kesrc="#data">This shows content of element who has id="data"</a> 
<div style="display: none;">
    <div id="data">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>
</div>

C、Iframe
<a href="http://www.example?iframe">This goes to iframe</a> 
或者
 <a class="iframe" href="http://www.example">This goes to iframe</a>


D、Ajax
<a href="http://www.example/data.php">This takes content using ajax</a>
如果你要显示描述信息,可以在链接上加上title,将描述信息放到title中。


4、最终的jquery初始化代码

[javascript] view plain copy
  1. $(document).ready(function() {   
  2.     /* 最基本的,使用了默认配置 */       
  3.     $("a#single_image").fancybox();       
  4.     /* 使用了自定义配置 */       
  5.     $("a#inline").fancybox({  
  6.         'hideOnContentClick'true  
  7.     });  
  8.    
  9.     /* 一下配置支持组播放 */       
  10.     $("a.group").fancybox({  
  11.         'transitionIn'  :   'elastic',  
  12.         'transitionOut' :   'elastic',  
  13.         'speedIn'       :   600,   
  14.         'speedOut'      :   200,   
  15.         'overlayShow'   :   false  
  16.     });  
  17.        
  18. });  


用rel标签来创建相册
  1. <a class="grouped_elements" rel="group1" href="image_big_1.jpg"><img src="image_small_1.jpg" alt=""></a>  
  2. <a class="grouped_elements" rel="group1" href="image_big_2.jpg"><img src="image_small_2.jpg" alt=""></a>        
  3. <a class="grouped_elements" rel="group2" href="image_big_3.jpg"><img src="image_small_3.jpg" alt=""></a>   
  4. <a class="grouped_elements" rel="group2" href="image_big_4.jpg"><img src="image_small_4.jpg" alt=""></a>   

[javascript] view plain copy
  1. $("a.grouped_elements").fancybox();  


Fancybox的API和配置选项说明
属性名默认值简要说明
padding10浏览框内边距,和css中的padding一个意思
margin20浏览框外边距,和css中的margin一个意思
opacityfalse如果为true,则fancybox在动画改变的时候透明度可以跟着改变
modalfalse如果为true,则'overlayShow' 会被设成 'true' , 'hideOnOverlayClick', 'hideOnContentClick', 'enableEscapeButton', 'showCloseButton' 会被设成 'false'
cyclicfalse如果为true,相册会循环播放
scrolling'auto'设置overflow的值来创建或隐藏滚动条,可以设置成 'auto', 'yes', or 'no'
width560设置iframe和swf的宽度,如果 'autoDimensions'为 'false',这也可以设置普通文本的宽度
height340设置iframe和swf的高度,如果 'autoDimensions'为 'false',这也可以设置普通文本的高度
autoScaletrue如果为true,fancybox可以自适应浏览器窗口大小
autoDimensionstrue在内联文本和ajax中,设置是否动态调整元素的尺寸,如果为true,请确保你已经为元素设置了尺寸大小
centerOnScrollfalse如果为true,当你滚动滚动条时,fancybox将会一直停留在浏览器中心
ajax{ }和jquery的ajax调用选项一样
注意: 'error' and 'success' 这两个回调事件会被fancybox重写
swf{wmode: 'transparent'}swf的设置选项
hideOnOverlayClicktrue如果为true则点击遮罩层关闭fancybox
hideOnContentClickfalse如果为true则点击播放内容关闭fancybox
overlayShowtrue如果为true,则显示遮罩层
overlayOpacity0.3遮罩层的透明度(范围0-1)
overlayColor'#666'遮罩层的背景颜色
titleShowtrue如果为true,则显示标题
titlePosition'outside'设置标题显示的位置.可以设置成 'outside', 'inside' 或 'over'
titleFormatnull可以自定义标题的格式
transitionIn, transitionOut'fade'设置动画效果. 可以设置为 'elastic', 'fade' 或 'none'
speedIn, speedOut300fade 和 elastic 动画切换的时间间隔, 以毫秒为单位
 
changeSpeed300切换时fancybox尺寸的变化时间间隔(即变化的速度),以毫秒为单位
changeFade'fast'切换时内容淡入淡出的时间间隔(即变化的速度)
easingIn, easingOut'swing'为 elastic 动画使用 Easing
showCloseButtontrue如果为true,则显示关闭按钮
showNavArrowstrue如果为true,则显示上一张下一张导航箭头
enableEscapeButtontrue如果为true,则启用ESC来关闭fancybox
onStartnull回调函数,加载内容是触发
onCancelnull回调函数,取消加载内容后触发
onCompletenull回调函数,加载内容完成后触发
onCleanupnull回调函数,关闭fancybox前触发
onClosednull回调函数,关闭fancybox后触发
 



http://blog.csdn.net/gaohuanjie/article/details/21163895

padding:默认值为10,浏览框内边距,和css中的padding一个意思。
margin: 默认值为20,浏览框外边距,和css中的margin一个意思。
opacity:默认值为false,如果为true,则fancybox在动画改变的时候透明度可以跟着改变。
modal:默认值为false,如果为true,则'overlayShow' 会被设成 'true' , 'hideOnOverlayClick', 'hideOnContentClick', 'enableEscapeButton', 'showCloseButton' 会被设成 'false'。
cyclic: 默认值为false,如果为true,相册会循环播放。
scrolling:默认值为'auto',设置overflow的值来创建或隐藏滚动条,可以设置成 'auto', 'yes', or 'no'。
width:默认值为560,设置iframe和swf的宽度,如果 'autoDimensions'为 'false',这也可以设置普通文本的宽度。
height: 默认值为340,设置iframe和swf的高度,如果 'autoDimensions'为 'false',这也可以设置普通文本的高度。
autoScale:默认值为true,如果为true,fancybox可以自适应浏览器窗口大小。
autoDimensions: 默认值为true,在内联文本和ajax中,设置是否动态调整元素的尺寸,如果为true,请确保你已经为元素设置了尺寸大小。
centerOnScroll: 默认值为false,如果为true,当你滚动滚动条时,fancybox将会一直停留在浏览器中心。
ajax:默认值为{ },和jquery的ajax调用选项一样。注意: 'error' and 'success' 这两个回调事件会被fancybox重写。
swf:默认值为{wmode: 'transparent'},swf的设置选项。
hideOnOverlayClick:默认值为true,如果为true则点击遮罩层关闭fancybox。
hideOnContentClick:默认值为false,如果为true则点击播放内容关闭fancybox。
overlayShow:默认值为true,如果为true,则显示遮罩层。
overlayOpacity: 默认值为0.3,遮罩层的透明度(范围0-1)。
overlayColor:默认值为'#666',遮罩层的背景颜色。
titleShow:默认值为true,如果为true,则显示标题。
titlePosition:默认值为'outside',设置标题显示的位置.可以设置成 'outside', 'inside' 或 'over'。
titleFormat:默认值为null,可以自定义标题的格式。
transitionIn, transitionOut:默认值为'fade',设置动画效果. 可以设置为 'elastic', 'fade' 或 'none'。
speedIn, speedOut:默认值为300,fade 和 elastic 动画切换的时间间隔, 以毫秒为单位。
changeSpeed:默认值为300,切换时fancybox尺寸的变化时间间隔(即变化的速度),以毫秒为单位。
changeFade:默认值为'fast',切换时内容淡入淡出的时间间隔(即变化的速度)。
easingIn, easingOut:默认值为'swing',为 elastic 动画使用 Easing。
showCloseButton:默认值为true,如果为true,则显示关闭按钮。
showNavArrows:默认值为true,如果为true,则显示上一张下一张导航箭头。
enableEscapeButton:默认值为true,如果为true,则启用ESC来关闭fancybox。
onStart:默认值为null,回调函数,加载内容是触发。
onCancel:默认值为null,回调函数,取消加载内容后触发。
onComplete:默认值为null,回调函数,加载内容完成后触发。
onCleanup:默认值为null,回调函数,关闭fancybox前触发。
onClosed:默认值为null,回调函数,关闭fancybox后触发。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值