纯CSS实现的可向前、向后的幻灯片效果
兼容性:IE6+ FireFox2+ Opera9+ 更新时间:2010-01-26
简介:无Javascript、无iframe,完全依靠CSS样式实现的幻灯效果,简单实用
在网页<head>区添加以下代码
<style type="text/css">
/* ================================================================
This copyright notice must be untouched at all times.
The original version of this stylesheet and the associated (x)html
is available at http://www.sharejs.com/menu/click-gallery-previous-next.html
Copyright (c) 2005-2009 Stu Nicholls. All rights reserved.
This stylesheet and the associated (x)html may be modified in any
way to fit your requirements.
=================================================================== */
#gallery {
width:640px;
height:750px;
margin:0 auto;
position:relative;
font-family:verdana, arial, sans-serif;
}
#gallery a.previous {display:block; height:40px; width:32px; background:url(click/previous.gif); position:absolute; left:0; top:560px;}
#gallery a.next {display:block; height:40px; width:32px; background:url(click/next.gif); position:absolute; right:0; top:560px;}
#gallery a b {display:none;}
#gallery #fullsize {
position:absolute;
left:0;
top:0;
height:800px;
width:640px;
overflow:hidden;
text-align:center;
}
#gallery #fullsize div {width:640px; height:900px; padding-top:10px; position:relative;}
#gallery #fullsize div img {clear:both; display:block; margin:0 auto; border:0;}
#gallery #fullsize div h3 {padding:10px 0 0 0; margin:0; font-size:18px;}
#gallery #fullsize div p {padding:5px 0; margin:0; font-size:12px; line-height:18px;}
</style>
在网页<body>区添加以下代码
<div id="gallery">
<div id="fullsize">
<div id="pic1">
<img src="click/pic1.jpg" alt="Ballet dancer" />
<a class="previous" href="#pic10"><b>Previous</b></a><a class="next" href="#pic2"><b>Next</b></a>
<h3>Ballet dancer</h3>
<p>Followed by some descriptive text and maybe a <a href="http://www.sharejs.com/">link</a>.</p>
</div>
<div id="pic2">
<img src="click/pic2.jpg" alt="Beetle on a daisy" />
<a class="previous" href="#pic1"><b>Previous</b></a><a class="next" href="#pic3"><b>Next</b></a>
<h3>Beetle on daisy</h3>
<p>Another piece of descriptive text and again a <a href="http://www.sharejs.com/">link</a>.</p>
</div>
<div id="pic3">
<img src="click/pic3.jpg" alt="Misty landscape" />
<a class="previous" href="#pic2"><b>Previous</b></a><a class="next" href="#pic4"><b>Next</b></a>
<h3>Misty landscape</h3>
<p>Yet more descriptive text and maybe a <a href="http://www.sharejs.com/">link</a>.</p>
</div>
<div id="pic4">
<img src="click/pic4.jpg" alt="Bird of prey" />
<a class="previous" href="#pic3"><b>Previous</b></a><a class="next" href="#pic5"><b>Next</b></a>
<h3>Bird of prey</h3>
<p>And another line of descriptive text and maybe a <a href="http://www.sharejs.com/">link</a>.</p>
</div>
<div id="pic5">
<img src="click/pic5.jpg" alt="Bird on barbed wire" />
<a class="previous" href="#pic4"><b>Previous</b></a><a class="next" href="#pic6"><b>Next</b></a>
<h3>Bird on barbed wire</h3>
<p>With descriptive text and maybe a <a href="http://www.sharejs.com/">link</a>.</p>
</div>
<div id="pic6">
<img src="click/pic6.jpg" alt="Isn't he cute" />
<a class="previous" href="#pic5"><b>Previous</b></a><a class="next" href="#pic7"><b>Next</b></a>
<h3>Isn't he cute?</h3>
<p>A description of the picture can go here with a <a href="http://www.sharejs.com/">link</a>.</p>
</div>
<div id="pic7">
<img src="click/pic7.jpg" alt="Ladybirds" />
<a class="previous" href="#pic6"><b>Previous</b></a><a class="next" href="#pic8"><b>Next</b></a>
<h3>Ladybirds</h3>
<p>Descriptive text and maybe a <a href="http://www.sharejs.com/">link</a>.</p>
</div>
<div id="pic8">
<img src="click/pic8.jpg" alt="Dragonfly" />
<a class="previous" href="#pic7"><b>Previous</b></a><a class="next" href="#pic9"><b>Next</b></a>
<h3>Dragonfly</h3>
<p>The text can be over as many lines as you want, but you may need to adjust the size of the containing div to make sure that it can all be seen. The <a href="http://www.sharejs.com/">link</a> can be used if you want.</p>
</div>
<div id="pic9">
<img src="click/pic9.jpg" alt="Grasshopper" />
<a class="previous" href="#pic8"><b>Previous</b></a><a class="next" href="#pic10"><b>Next</b></a>
<h3>Grasshopper</h3>
<p>Followed by some descriptive text and maybe a <a href="http://www.sharejs.com/">link</a>.</p>
</div>
<div id="pic10">
<img src="click/pic10.jpg" alt="Green lizard" />
<a class="previous" href="#pic9"><b>Previous</b></a><a class="next" href="#pic1"><b>Next</b></a>
<h3>Green lizard</h3>
<p>Another piece of descriptive text and maybe a <a href="http://www.sharejs.com/">link</a>.</p>
</div>
</div>
</div>
上一篇: 纯CSS实现,带数字显示的相册效果 下一篇: 纯CSS带预览功能、可前后翻页的幻灯片效果
本类最新
本类热门