jquery-lightbox应用,一个简单的相册效果,代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Demo : Portfolio using jQuery</title>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery-lightbox.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#wrap a").lightBox();
});
</script>
<style type="text/css">
body, ul, li, img { margin: 0; padding: 0; border: 0;}
body { background: #003346; }
#wrap {width:800px; margin: 100px auto;}
#wrap h2{font-size:30px; font-weight:bold; font-family:Arial, Helvetica, sans-serif; color:#CCCCCC; margin:0 0 20px 13px;}
#wrap ul{margin:0; padding:0}
#wrap li {list-style: none; float: left; margin: 15px;}
#wrap a img {border: 5px solid #aaa; }
#wrap a:hover img {border: 5px solid #75879d;}
/**
* jQuery lightBox plugin
* This jQuery plugin was inspired and based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/)
* and adapted to me for use like a plugin from jQuery.
* @name jquery-lightbox-0.5.css
* @author Leandro Vieira Pinho - http://leandrovieira.com
* @version 0.5
* @date April 11, 2008
* @category jQuery plugin
* @copyright (c) 2008 Leandro Vieira Pinho (leandrovieira.com)
* @license CCAttribution-ShareAlike 2.5 Brazil - http://creativecommons.org/licenses/by-sa/2.5/br/deed.en_US
* @example Visit http://leandrovieira.com/projects/jquery/lightbox/ for more informations about this jQuery plugin
*/
#jquery-overlay {position: absolute;top: 0;left: 0;z-index: 90;width: 100%;height: 500px;}
#jquery-lightbox {position: absolute;top: 0;left: 0;width: 100%;z-index: 100;text-align: center;line-height: 0;}
#jquery-lightbox a img { border: none; }
#lightbox-container-image-box {position: relative;background-color: #fff;width: 250px;height: 250px;margin: 0 auto;}
#lightbox-container-image { padding: 10px; }
#lightbox-loading {position: absolute;top: 40%;left: 0%;height: 25%;width: 100%;text-align: center;line-height: 0;}
#lightbox-nav { position: absolute;top: 0;left: 0;height: 100%;width: 100%;z-index: 10;}
#lightbox-container-image-box > #lightbox-nav { left: 0;}
#lightbox-nav a { outline: none;}
#lightbox-nav-btnPrev, #lightbox-nav-btnNext {width: 49%;height: 100%;zoom: 1;display: block;}
#lightbox-nav-btnPrev { left: 0; float: left;}
#lightbox-nav-btnNext { right: 0; float: right;}
#lightbox-container-image-data-box { font: 10px Verdana, Helvetica, sans-serif; background-color: #fff; margin: 0 auto; line-height: 1.4em; overflow: auto; width: 100%; padding: 0 10px 0;}
#lightbox-container-image-data {padding: 0 10px; color: #666; }
#lightbox-container-image-data #lightbox-image-details { width: 70%; float: left; text-align: left; }
#lightbox-image-details-caption { font-weight: bold; }
#lightbox-image-details-currentNumber {display: block; clear: left; padding-bottom: 1.0em;}
#lightbox-secNav-btnClose { width: 66px; float: right; padding-bottom: 0.7em;}
</style>
</head>
<body>
<div id="wrap">
<h2>Portfolio using jQuery</h2>
<ul>
<li><a href="images/01a.jpg"><img src="images/01.jpg" alt="Test 1" /></a></li>
<li><a href="images/02a.jpg"><img src="images/02.jpg" alt="Test 2" /></a></li>
<li><a href="images/03a.jpg"><img src="images/03.jpg" alt="Test 3" /></a></li>
<li><a href="images/04a.jpg"><img src="images/04.jpg" alt="Test 4" /></a></li>
<li><a href="images/05a.jpg"><img src="images/05.jpg" alt="Test 5" /></a></li>
<li><a href="images/03a.jpg"><img src="images/03.jpg" alt="Test 3" /></a></li>
</ul>
</div>
</body>
</html>