zoukankan      html  css  js  c++  java
  • 基于jQuery的楼层案例

    ~(function() {
                var flag = true;
    
                //点击切换效果
                $(".oDR7_asideItem:not(:first)").click(function() {
                    flag = false;
                    //alert($(".oRD8_stairs").length);
                    $(".oDR7_asideItem").removeClass("oDR7_active").find("span").removeClass("oDR7_activeDot").removeClass("oDR7_color");
                    $(this).addClass("oDR7_active").find("span:nth-of-type(2)").addClass("oDR7_activeDot").end().find("span:last-of-type").addClass("oDR7_color");
                    var sTop = $(".oRD8_stairs").eq($(this).index()-1).offset().top - 165;
                    $("body,html").animate({
                        "scrollTop": sTop
                    }, 1000, function() {
                        flag = true;
                    });
                });
    
                //滚动条滚动效果
                $(window).scroll(function() {
                    if (flag) {
                        var sTop = $(document).scrollTop();
                        //alert($(".oRD8_stairs2").length);
                        var $floor = $(".oRD8_stairs2").filter(function(index, ele) {
                            return Math.abs($(this).offset().top - sTop) < $(this).height() / 2;
                        });
                        if($floor.index()-1 > 0) {
                            $(".oDR7_asideItem").removeClass("oDR7_active").find("span").removeClass("oDR7_activeDot").removeClass("oDR7_color");
                            $(".oRD7_stairs2List").eq($floor.index()-1).addClass("oDR7_active").find("span:nth-of-type(2)").addClass("oDR7_activeDot").end().find("span:last-of-type").addClass("oDR7_color");
                        }
                    }
                });
    
                //悬浮效果
                $(".oDR7_asideItem:not(:first)").hover(function() {
                    $(".oDR7_asideItem").removeClass("oDR7_active").find("span").removeClass("oDR7_activeDot").removeClass("oDR7_color");
                    $(this).addClass("oDR7_active").find("span:nth-of-type(2)").addClass("oDR7_activeDot").end().find("span:last-of-type").addClass("oDR7_color");
                },function() {});
            })();
  • 相关阅读:
    Windows API 的数据类型与 Delphi 数据类型对照表
    Delphi 编译错误信息表
    Delphi中的容器类
    Delphi 快捷键
    代码折叠
    [转]Delphi中record的使用
    [转]常用公共函数单元
    Delphi 运行时错误信息表
    C#调用Win32 的API函数User32.dll
    [转]Delphi程序启动参数的读取
  • 原文地址:https://www.cnblogs.com/intelwisd/p/7521479.html
Copyright © 2011-2022 走看看