非常好用的弹层显示插件,官网地址:http://www.fancyapps.com/fancybox/
源码下载:https://github.com/fancyapps/fancyBox
使用说明:
一、引入必要的文件
<link href="css/jquery.fancybox.css" rel="stylesheet" type="text/css">
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<script src="js/jquery.fancybox.pack.js"></script>
二、写上启动代码
<script>
$(document).ready(function() {
$('.fancybox').fancybox();
});
</script>
三、在需要调用的位置写上样式以及对应的链接地址,适用于图片、隐藏层、内嵌iframe等
//Ajax:
<a href="/example.html" class="fancybox fancybox.ajax">Example</a>
//or
<a href="/example.html" class="fancybox" data-fancybox-type="ajax">Example</a>
//Iframe:
<a href="example.html" class="fancybox fancybox.iframe">Example</a>
//Inline (will display an element with `id="example"`)
<a href="#example" class="fancybox">Example</a>
//SWF:
<a href="example.swf" class="fancybox">Example</a>
//Image:
<a class="fancybox" rel="group" href="big_image_1.jpg"><img src="small_image_1.jpg" alt="" /></a>