zxlperfect
V2EX  ›  问与答

js代码修改

  •  
  •   zxlperfect · Apr 23, 2013 · 3612 views
    This topic created in 4794 days ago, the information mentioned may be changed or developed.
    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 replies    1970-01-01 08:00:00 +08:00
    cutehalo
        1
    cutehalo  
       Apr 23, 2013   ❤️ 1
    html里面把两个li去掉就行了
    下面icon的li
    对应了上面内容ul里面的一个li
    不过那个icon是一张图片
    zxlperfect
        2
    zxlperfect  
    OP
       Apr 23, 2013
    @cutehalo 我把多余的li删了,下面的icon图片尺寸也改成合适的了,css也对应了。但是icon直接不显示了是怎么回事?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3685 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 10:36 · PVG 18:36 · LAX 03:36 · JFK 06:36
    ♥ Do have faith in what you're doing.