一个基于jquery的Lightbox插件fantybox
支持向放大的图像添加阴影,并向一组相关图像添加导航按钮。fanybox是一个华丽的jquery弹出显示插件。该灯箱可以显示图像以及iframed内容,并使用css自定义外观。
官方网站:http://www.fancybox.net/home
下载地址:https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/fancybox/jquery.fancybox-1.3.4.zip
使用示例:
1、引入Jquery文件
<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>
2、引入Fancybox样式文件
<link rel=”stylesheet” href=”/fancybox/jquery.fancybox-1.3.4.css” rel=”external nofollow” type=”text/css” media=”screen” />
3、在需要使用Fancybox的图片中加上属性
<a class=”grouped_elements” rel=”group1″ href=”image_big_1.jpg” rel=”external nofollow” ><img src=”image_small_1.jpg” alt=””/></a>
<a class=”grouped_elements” rel=”group1″ href=”image_big_2.jpg” rel=”external nofollow” ><img src=”image_small_2.jpg” alt=””/></a>
<a class=”grouped_elements” rel=”group2″ href=”image_big_3.jpg” rel=”external nofollow” ><img src=”image_small_3.jpg” alt=””/></a>
<a class=”grouped_elements” rel=”group2″ href=”image_big_4.jpg” rel=”external nofollow” ><img src=”image_small_4.jpg” alt=””/></a>
4、JS文件控制:
<script type=”text/javascript”>
jQuery(document).ready(function ($) {
$(“a[rel=group1]”).fancybox({
‘titleShow’: true,
‘transitionIn’: ‘none’,
‘showNavArrows’: true,
‘transitionOut’: ‘none’
});
})
</script>
文章来源网络,作者:运维,如若转载,请注明出处:https://shuyeidc.com/wp/115292.html<