V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
zxlperfect
V2EX  ›  问与答

js代码修改

  •  
  •   zxlperfect · 2013-04-23 09:53:06 +08:00 · 2804 次点击
    这是一个创建于 3993 天前的主题,其中的信息可能已经有所发展或是发生改变。
    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;
    }
    2 条回复    1970-01-01 08:00:00 +08:00
    cutehalo
        1
    cutehalo  
       2013-04-23 10:18:43 +08:00   ❤️ 1
    html里面把两个li去掉就行了
    下面icon的li
    对应了上面内容ul里面的一个li
    不过那个icon是一张图片
    zxlperfect
        2
    zxlperfect  
    OP
       2013-04-23 11:26:26 +08:00
    @cutehalo 我把多余的li删了,下面的icon图片尺寸也改成合适的了,css也对应了。但是icon直接不显示了是怎么回事?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5753 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 06:11 · PVG 14:11 · LAX 23:11 · JFK 02:11
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.