用户注册



邮箱:

密码:

用户登录


邮箱:

密码:
记住登录一个月忘记密码?

发表随想


还能输入:200字
云代码 - javascript代码库

jQuery图片幻灯片播放插件SlideShow(带缩略图)

2013-01-25 作者: 小蜜锋举报

[javascript]代码库

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="main.css" type="text/css">
<script type="text/javascript" src="jquery-1.4.1.min.js"></script>
<title>jQuery图片幻灯片播放插件SlideShow(带缩略图)</title>
</head>
<body>
<br>
<br>
<br>
<div id='wrapper'>
  <div id='body'>
    <div id="bigPic"> <img src="imgs/1.jpg" alt="" /> <img src="imgs/2.jpg" alt="" /> <img src="imgs/3.jpg" alt="" /> <img src="imgs/4.jpg" alt="" /> <img src="imgs/5.jpg" alt="" /> <img src="imgs/6.jpg" alt="" /> <img src="imgs/7.jpg" alt="" /> <img src="imgs/8.jpg" alt="" /> <img src="imgs/9.jpg" alt="" /> <img src="imgs/10.jpg" alt="" /> </div>
    <ul id="thumbs">
      <li class='active' rel='1'><img src="imgs/1_thumb.jpg" alt="" /></li>
      <li rel='2'><img src="imgs/3_thumb.jpg" alt="" /></li>
      <li rel='3'><img src="imgs/4_thumb.jpg" alt="" /></li>
      <li rel='4'><img src="imgs/5_thumb.jpg" alt="" /></li>
      <li rel='5'><img src="imgs/6_thumb.jpg" alt="" /></li>
      <li rel='6'><img src="imgs/7_thumb.jpg" alt="" /></li>
      <li rel='7'><img src="imgs/8_thumb.jpg" alt="" /></li>
      <li rel='8'><img src="imgs/9_thumb.jpg" alt="" /></li>
      <li rel='9'><img src="imgs/10_thumb.jpg" alt="" /></li>
      <li rel='10'><img src="imgs/2_thumb.jpg" alt="" /></li>
    </ul>
  </div>
  <div class='clearfix'></div>
</div>
<script type="text/javascript">
	var currentImage;
    var currentIndex = -1;
    var interval;
    function showImage(index){
        if(index < $('#bigPic img').length){
        	var indexImage = $('#bigPic img')[index]
            if(currentImage){   
            	if(currentImage != indexImage ){
                    $(currentImage).css('z-index',2);
                    clearTimeout(myTimer);
                    $(currentImage).fadeOut(250, function() {
					    myTimer = setTimeout("showNext()", 3000);
					    $(this).css({'display':'none','z-index':1})
					});
                }
            }
            $(indexImage).css({'display':'block', 'opacity':1});
            currentImage = indexImage;
            currentIndex = index;
            $('#thumbs li').removeClass('active');
            $($('#thumbs li')[index]).addClass('active');
        }
    }
    
    function showNext(){
        var len = $('#bigPic img').length;
        var next = currentIndex < (len-1) ? currentIndex + 1 : 0;
        showImage(next);
    }
    
    var myTimer;
    
    $(document).ready(function() {
	    myTimer = setTimeout("showNext()", 3000);
		showNext(); //loads first image
        $('#thumbs li').bind('click',function(e){
        	var count = $(this).attr('rel');
        	showImage(parseInt(count)-1);
        });
	});
</script>
</body>
</html>

[代码运行效果截图]


jQuery图片幻灯片播放插件SlideShow(带缩略图)

[源代码打包下载]




网友评论    (发表评论)


发表评论:

评论须知:

  • 1、评论每次加2分,每天上限为30;
  • 2、请文明用语,共同创建干净的技术交流环境;
  • 3、若被发现提交非法信息,评论将会被删除,并且给予扣分处理,严重者给予封号处理;
  • 4、请勿发布广告信息或其他无关评论,否则将会删除评论并扣分,严重者给予封号处理。


扫码下载

加载中,请稍后...

输入口令后可复制整站源码

加载中,请稍后...