zoukankan      html  css  js  c++  java
  • jquery之滚楼


    $(function () {
        $(" #ul1 li").hover(function () {
            $(this).addClass("lihover");
        }, function () {
            $(this).removeClass("lihover");
        });
    
        $(".divbody").mousewheel(function (event, delta, deltaX, deltaY) {
            //document.title = "delta=" + delta + "deltaX=" + deltaX + "deltaY=" + deltaY;
            //console.log(delta, deltaX, deltaY);
            //向上        
            if (delta > 0) {
                //console.log("向上");
                iIndex = iIndex - 1;
                if (iIndex <= 0) {
                    iIndex = 1;
                }
                document.title = iIndex;
                liclick(iIndex);
            }
            //向下
            if (delta < 0) {
                //console.log("向下");
                iIndex = iIndex + 1;
                if (iIndex >= 10) {
                    iIndex = 10;
                }
                document.title = iIndex;
                liclick(iIndex);
            }
        });
    });
    
    var iIndex = 0;
    function liclick(vindex) {
        iIndex = vindex;
        $("#ul1 li").eq(vindex - 1).addClass("liActive");
        $("#ul1 li").eq(vindex - 1).siblings("#ul1 li").removeClass("liActive");
        $("body,html").stop(true, true);
        var vtop = $("#divLayer" + vindex).offset().top;
        //-------------------图片加载完成之后转动-----------------------
        $("body,html").animate({ "scrollTop": vtop - 51 }, 500, function () {
            $("img").eq(vindex - 1).addClass("img1");
        });
    
    
        if ($("img").eq(vindex - 1).hasClass("img1")) {
            $("img").eq(vindex - 1).removeClass("img1");
        }
        //$("img").eq(vindex - 1).removeClass("img1");
    }






  • 相关阅读:
    BZOJ2988 : DIVISORS
    BZOJ1255 : Pku2332 One is good, but two is better
    BZOJ2411 : 黄牌
    BZOJ2887 : 旅行
    BZOJ2353 : 矩形压缩
    BZOJ2997 : 想法计数
    BZOJ2092 : [Poi2010]Lamp
    Potyczki Algorythmiczne 2019
    2019-2020 ICPC Asia Hong Kong Regional Contest
    The 2019 China Collegiate Programming Contest Harbin Site
  • 原文地址:https://www.cnblogs.com/cxd1008/p/6372444.html
Copyright © 2011-2022 走看看