自动播放的jQuery幻灯片

来看下效果图:

 

 

<script src="jquery.js" type="text/javascript"></script>
<script type="text/javascript">
var theInt = null;
var curclicked = 0;

$(function(){
	autoPlay();
})

function autoPlay(){
$('#transparence').css('opacity','0.4');
	$('#pic_list img').css({'opacity':'0.6'});
	$('#pic_list img:eq(0)').css({'top':'0','opacity':'1'});
	$('#pic_list a').click(function(){return false});
	t(0);
	$('#pic_list img').mouseover(function(){
		if($('#big_pic').attr('src') == $(this).attr('src')) return;
		t($('#pic_list img').index($(this)));
	});
}

  t = function(i){
	clearInterval(theInt);
	if( typeof i != 'undefined' )
    curclicked = i;
		$('#big_pic').fadeOut(0).fadeIn(500).attr('src',$('#pic_list img').eq(i).attr('src'));
		$('#big_imgs').attr('href',$('#pic_list img').eq(i).parents('a').attr('href'));
		$('#big_imgs').attr('title',$('#pic_list img').eq(i).parents('a').attr('title'));
		$('#pic_list img').eq(i).parents('li').nextAll('li').find('img').animate({top:15,opacity:0.6},500);
		$('#pic_list img').eq(i).parents('li').prevAll('li').find('img').animate({top:15,opacity:0.6},500);
		$('#pic_list img').eq(i).animate({top:0},500).css('opacity','1');
    theInt = setInterval(function (){
      i++;
      if (i > $('#pic_list img').length - 1) {i = 0};
      $('#big_pic').fadeOut(0).fadeIn(500).attr('src',$('#pic_list img').eq(i).attr('src'));
      $('#big_imgs').attr('href',$('#pic_list img').eq(i).parents('a').attr('href'));
      $('#big_imgs').attr('title',$('#pic_list img').eq(i).parents('a').attr('title'));
      $('#pic_list img').eq(i).parents('li').nextAll('li').find('img').animate({top:15,opacity:0.6},500);
      $('#pic_list img').eq(i).parents('li').prevAll('li').find('img').animate({top:15,opacity:0.6},500);
      $('#pic_list img').eq(i).animate({top:0},500).css('opacity','1');
    },3000)
}
</script>

 

<style type="text/css">
body,div,ul,li { margin:0; padding:0;}
#autoplay { position:relative; width:342px; height:228px;} 
#transparence { position:absolute; left:0; bottom:0; width:100%; height:37px; border-top:1px solid #fff; background:#000; z-index:1;}  
#pic_list { position:absolute; left:0; bottom:0; list-style:none; overflow:hidden; z-index:2;} 
#pic_list li { float:left; width:39px; height:37px; padding-top:10px;margin:0 3px;}
#pic_list li img { position:absolute; top:15px; width:37px; height:25px; border:1px solid #fff;} 
#big_pic { position:absolute; width:100%; height:100%; border:none;}
</style>

 

<div id="autoplay">
	<a href="http://ice-cream.iteye.com/picture/8308" id="big_imgs"><img src="http://ice-cream.iteye.com/upload/picture/pic/8308/fe1bdce7-17d9-35c6-90a9-8cdf961df3e4.jpg" id="big_pic" alt=""></a>
	<ul id="pic_list">
		<li><a href="http://ice-cream.iteye.com/picture/8308"><img src="http://ice-cream.iteye.com/upload/picture/pic/8308/fe1bdce7-17d9-35c6-90a9-8cdf961df3e4.jpg" alt=""></a></li>
		<li><a href="http://ice-cream.iteye.com/picture/13325"><img src="http://ice-cream.iteye.com/upload/picture/pic/13325/3aeca676-fc57-3c9a-9407-70eeaf6ea84e.jpg" alt=""></a></li>
		<li><a href="http://ice-cream.iteye.com/picture/8352"><img src="http://ice-cream.iteye.com/upload/picture/pic/8352/1b6561c4-4a0b-39df-982b-322d6650b553.jpg" alt=""></a></li>
	</ul>
	<span id="transparence"></span>
</div>
 

demo code download

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值