[html]代码库
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jQuery通栏自适应浏览器宽度的Banner幻灯片</title>
<link rel="stylesheet" type="text/css" href="style/Vizo-style.css" media="all" />
<script type="text/javascript" src="script/jquery-1.6.2.min.js">
</script>
<script type="text/javascript">
//<![CDATA[
$(document).ready(function(){
$(".item1").hover(function(){$("#tit_fc1").slideDown("normal"); }, function() {$("#tit_fc1").slideUp("fast");});
$(".item2").hover(function(){$("#tit_fc2").slideDown("normal"); }, function() {$("#tit_fc2").slideUp("fast");});
$(".item3").hover(function(){$("#tit_fc3").slideDown("normal"); }, function() {$("#tit_fc3").slideUp("fast");});
$(".item4").hover(function(){$("#tit_fc4").slideDown("normal"); }, function() {$("#tit_fc4").slideUp("fast");});
});
var currentindex=1;
$("#flashBg").css("background-color",$("#flash1").attr("name"));
function changeflash(i) {
currentindex=i;
for (j=1;j<=5;j++){//此处的5代表你想要添加的幻灯片的数量与下面的5相呼应
if (j==i)
{$("#flash"+j).fadeIn("normal");
$("#flash"+j).css("display","block");
$("#f"+j).removeClass();
$("#f"+j).addClass("dq");
$("#flashBg").css("background-color",$("#flash"+j).attr("name"));
}
else
{$("#flash"+j).css("display","none");
$("#f"+j).removeClass();
$("#f"+j).addClass("no");}
}}
function startAm(){
timerID = setInterval("timer_tick()",8000);//8000代表间隔时间设置
}
function stopAm(){
clearInterval(timerID);
}
function timer_tick() {
currentindex=currentindex>=5?1:currentindex+1;//此处的5代表幻灯片循环遍历的次数
changeflash(currentindex);}
$(document).ready(function(){
$(".flash_bar div").mouseover(function(){stopAm();}).mouseout(function(){startAm();});
startAm();
});
//]]>
</script>
<!--[if IE 6]>
<script type="text/javascript" src="script/DD_belatedPNG_0.0.8a-min.js"></script>
<script type="text/javascript">
//<![CDATA[
DD_belatedPNG.fix('.flash_bar,#tit_fc1,#tit_fc2,#tit_fc3,#tit_fc4,#flashLine,#leftIcon1,#leftIcon2,#leftIcon3');
//]]>
</script>
<![endif]-->
</head>
<body style="background:#eee;">
<!--Logo & Navigation Start-->
<!--Logo & Navigation End-->
<!--Slide & Banner Start-->
<div id="Slidebox">
<!--flash begin-->
<div id="flashBg">
<div id="flashLine">
<div id="flash"> <a name="#e0b98b" style="display:block;" id="flash1" target="_blank" href="http://yuncode.net"><img src="images/Slides-1.png" width="1000" height="388"></a> <a name="#6b9a7a" style="display:block" id="flash2" target="_blank" href="http://yuncode.net"><img src="images/Slides-2.png" width="1000" height="388"></a> <a name="#082841" id="flash3" target="_blank" href="http://yuncode.net"><img src="images/Slides-3.png" width="1000" height="388"></a> <a name="#9f9d60" id="flash4" target="_blank" href="http://yuncode.net"><img src="images/Slides-4.png" width="1000" height="388"></a> <a name="#c53652" id="flash5" target="_blank" href="http://yuncode.net"><img src="images/Slides-5.png" width="1000" height="388"></a>
<div class="flash_bar">
<div class="dq" id="f1" onclick="changeflash(1)"></div>
<div class="no" id="f2" onclick="changeflash(2)"></div>
<div class="no" id="f3" onclick="changeflash(3)"></div>
<div class="no" id="f4" onclick="changeflash(4)"></div>
<div class="no" id="f5" onclick="changeflash(5)"></div>
</div>
</div>
</div>
</div>
<!--flash end-->
</div>
<!--Slide & Banner End-->
<!--RollingNews Start-->
<!--RollingNews End-->
<!--FeatureContent start-->
<!--FeatureContent end-->
<!--Four Signs content start-->
<!--Four Signs content end-->
<!--Footer start-->
<!--Footer end-->
</body>
</html>
[代码运行效果截图]
[源代码打包下载]