lqh280
|
|
[求助]首页滚动图片一次滚动5个图问题
首页面脚的滚动图片,如何设置一次滚动5个图?
是改js/main.js里面对应的内容吗?要怎么改? // 首页滚动图片 (function() { var time = 2000; // 滚动间隔时间 var obj = $(".piclist .p_cont ul li"); var len = obj.length; if(len < 5) return false; var obj2 = $(".piclist .p_cont ul"); var w = obj.outerWidth(true); obj2.width(w*len*2+10).append(obj2.html());
var old_left = obj2.position().left; var new_left = old_left; var run = function (type) { if(type > 0) { if(new_left >= old_left) { var d_l = -(w*len); obj2.stop(true).css("left", d_l); new_left = d_l; } new_left = new_left + w; }else{ if(new_left <= -(w*len)) { obj2.stop(true).css("left", old_left); new_left = old_left; } new_left = new_left - w; } obj2.animate({left: new_left+3},150).animate({left: new_left-3},150).animate({left: new_left},150); }
var r = setInterval(function() { run(-1); }, time); $(".piclist").hover(function(){ clearInterval(r); }, function() { r = setInterval(function() { run(-1); }, time); });
$(".piclist .p_prev").click(function(){ run(1); }); $(".piclist .p_next").click(function(){ run(-1); }); })();
|
|
|
发帖时间:2014-8-28 |
查看数:0 |
回复数:0
|