js代码修改

2013-04-23 09:53:06 +08:00
 zxlperfect
http://www.lanrentuku.com/js/jiaodiantu-971.html
这个滑动有8个屏,怎样才能改成6个?

var curIndex = 0;
var time = 800;
var slideTime = 5000;
var adTxt = $("#banner_img>li>div>.ad_txt");
var adImg = $("#banner_img>li>div>.ad_img");
var int = setInterval("autoSlide()", slideTime);
$("#banner_ctr>ul>li[class!='first-item'][class!='last-item']").click(function () {
show($(this).index("#banner_ctr>ul>li[class!='first-item'][class!='last-item']"));
window.clearInterval(int);
int = setInterval("autoSlide()", slideTime);
});
function autoSlide() {
curIndex + 1 >= $("#banner_img>li").size() ? curIndex = -1 : false;
show(curIndex + 1);
}
function show(index) {
$.easing.def = "easeOutQuad";
$("#drag_ctr,#drag_arrow").stop(false, true).animate({ left: index * 115 + 20 }, 300);
$("#banner_img>li").eq(curIndex).stop(false, true).fadeOut(time);
adTxt.eq(curIndex).stop(false, true).animate({ top: "340px" }, time);
adImg.eq(curIndex).stop(false, true).animate({ right: "120px" }, time);
setTimeout(function () {
$("#banner_img>li").eq(index).stop(false, true).fadeIn(time);
adTxt.eq(index).children("p").css({ paddingTop: "50px", paddingBottom: "50px" }).stop(false, true).animate({ paddingTop: "0", paddingBottom: "0" }, time);
adTxt.eq(index).css({ top: "0", opacity: "0" }).stop(false, true).animate({ top: "170px", opacity: "1" }, time);
adImg.eq(index).css({ right: "-50px", opacity: "0" }).stop(false, true).animate({ right: "10px", opacity: "1" }, time);
}, 200)
curIndex = index;
}
2832 次点击
所在节点    问与答
2 条回复
cutehalo
2013-04-23 10:18:43 +08:00
html里面把两个li去掉就行了
下面icon的li
对应了上面内容ul里面的一个li
不过那个icon是一张图片
zxlperfect
2013-04-23 11:26:26 +08:00
@cutehalo 我把多余的li删了,下面的icon图片尺寸也改成合适的了,css也对应了。但是icon直接不显示了是怎么回事?

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/66669

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX