描述:facebox是一个jquery为基础的lightbox,可显示图像, divs ,或者远程页面。 它的使用简单,容易。
图片展示:
兼容浏览器:IE6+/Firefox/Google Chrome
官方链接:http://famspam.com/facebox/
JS下载:http://www.ijquery.cn/js/facebox/facebox.js
预览:http://www.ijquery.cn/study/demo/facebox/
打包下载:http://www.ijquery.cn/study/demo/facebox/facebox.zip
参数说明:无
JS引用代码:
[js]
<script src="http://www.ijquery.cn/js/jquery-1.7.2.min.js" type="text/javascript"></script>
<script src="http://www.ijquery.cn/js/facebox/facebox.js" type="text/javascript"></script>
<script type="text/javascript">
$(function($) {
$('a[rel*=facebox]').facebox()
})
</script>
[/js]
HTML代码:
这里需要注意的是(一)在弹出对象里rel加入facebox(二)在href里加入被操作对象的#id(三)在被操作对象里隐藏,即display:none!!!
[html]
<a href="#mydiv" rel="facebox">请点击这里</a>
<div id="mydiv" style="display:none">
<img src="demo.jpg" width="200" height="200" alt="" title="" />
</div>
[/html]
CSS代码:
这里有好多图片,最好源代码后再进行操作!
[css]
<link href="http://www.ijquery.cn/js/facebox/facebox.css" media="screen" rel="stylesheet" type="text/css" />
[/css]
即:
[css]
#facebox .b {
background:url(b.png);
}
#facebox .tl {
background:url(tl.png);
}
#facebox .tr {
background:url(tr.png);
}
#facebox .bl {
background:url(bl.png);
}
#facebox .br {
background:url(br.png);
}
#facebox {
position: absolute;
width: 100%;
top: 0;
left: 0;
z-index: 100;
text-align: left;
}
#facebox .popup {
position: relative;
}
#facebox table {
margin: auto;
border-collapse: collapse;
}
#facebox .body {
padding: 10px;
background: #fff;
}
#facebox .loading {
text-align: center;
}
#facebox .image {
text-align: center;
}
#facebox img {
border: 0;
}
#facebox .footer {
border-top: 1px solid #DDDDDD;
padding-top: 5px;
margin-top: 10px;
text-align: right;
}
#facebox .tl, #facebox .tr, #facebox .bl, #facebox .br {
height: 10px;
width: 10px;
overflow: hidden;
padding: 0;
}
[/css]