jquery 图片轮播怎么设置?求高手帮忙

我是jquery初学者,还不是很了解jquery,求高手帮忙。<script>$(function(){$("div#numspan").hover(function()... 我是jquery初学者,还不是很了解jquery,求高手帮忙。
<script>
$(function(){

$("div#num span").hover(function(){
$(this).parent().children().removeClass("cut");
$(this).addClass("cut");
$("div#ass").animate({left:"-400"},5000).index();

});
});
</script>
<style>
#pic{width:400px; height:210px; overflow:hidden; margin:0 auto; margin-top:100px}
#pic div#gg{
width:398px;
height:198px;
position:relative;
overflow:hidden;
z-index: 1;
}
#pic div#num{
width:100px;
height:20px;
position:absolute;
left: 279px;
top: 164px; z-index:3;
}
#pic div#num span{width:20px; height:20px; cursor:pointer; line-height:20px; float:left; text-align:center; color:#000000}
#pic div#num span.cut{background:#000000; color:#FFFFFF;}
#pic img{width:400px; height:200px; float:left; }

#pic div#ass{
width:2000px;
position:absolute;
z-index:0;
height:195px; z-index:2;
}

</style>
<div id="pic"><div id="gg">
<div id="ass"><img src="file:///C|/Users/pb/Desktop/图片/5426070_105541074311_2.jpg" /><img src="file:///C|/Users/pb/Desktop/图片/8092962_121630541372_2.jpg" /><img src="file:///C|/Users/pb/Desktop/图片/8092962_183443922000_2.jpg" /></div>
<div id="num"><span class="cut">1</span><span>2</span><span>3</span><span>4</span></div>
</div></div>
不让它自动循环播放,鼠标经过相应的数字就显示相应的图片。
展开
 我来答
yugi111
推荐于2016-01-05 · TA获得超过8.1万个赞
知道大有可为答主
回答量:5.1万
采纳率:70%
帮助的人:1.3亿
展开全部
<!DOCTYPE html>
<html>
  <head>
<meta charset=UTF-8>
<title>
RunJS 演示代码
</title>
<style>
#pic{
width:400px;
height:210px;
overflow:hidden;
margin:0 auto;
margin-top:100px;
}
#pic div#gg{
width:398px;
height:198px;
position:relative;
overflow:hidden;
z-index: 1;
}
#pic div#num{
width:100px;
height:20px;
position:absolute;
left: 279px;
top: 164px;
z-index:3;
}
#pic div#num span{
width:20px;
height:20px;
cursor:pointer;
line-height:20px;
float:left;
text-align:center;
color:#000000;
}
#pic div#num span.cut{
background-color:#000000;
color:#FFFFFF;
}
#pic img{
width:400px;
height:200px;
float:left;
}

#pic div#ass{
width:2000px;
position:absolute;
z-index:0;
height:195px;
z-index:2;
}

</style>
<script id="jquery_180" type="text/javascript" class="library" src="/js/sandbox/jquery/jquery-1.8.0.min.js"></script>
<script>
jQuery(function($){
var w = $("img").width();
$("span").hover(function(){
var me = $(this);
me.addClass("cut").siblings("span.cut").removeClass("cut");
$("#ass").stop().animate({
left: "-" + w * me.index() + "px"
}, "slow");
});
});
</script>

  </head>
<body>
<div id="pic">
<div id="gg">
<div id="ass">
<img src="https://gss0.baidu.com/8_BXsjip0QIZ8tyhnq/timg?wh_rate=0&wapiknow&quality=100&size=w250&sec=0&di=513c25df22650d5a18aee135fdc8ca01&src=http%3A%2F%2Fimg.iknow.bdimg.com%2Fzhidaoribao2014%2F2015year%2F0314%2F4.jpg" />
<img src="https://gss0.baidu.com/8_BXsjip0QIZ8tyhnq/timg?wh_rate=0&wapiknow&quality=100&size=w250&sec=0&di=45039ef63beef48c27123fbfd1d0fa87&src=http%3A%2F%2Fimg.iknow.bdimg.com%2Fzhidaoribao2014%2F2015year%2F0314%2F2.jpg" />
<img src="http://cdn.iknow.bdimg.com/static/question/widget/user/info/daily/img/daily_b734a6b.png" />
</div>
<div id="num">
<span class="cut">
1
</span>
<span>
2
</span>
<span>
3
</span>
</div>
</div>
</div>
  </body>
</html>
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式