咨询热线:18076568990、0755-25823180

[求助] 楼层导航的问题 33好的

2375 4 lhlt138 发表于 2016-9-13 09:38:29
QQ截图20160913093549.png


/*监听滚动条和左侧菜单点击事件 start b y 33 hao.com*/
            var _arr = [];
            window.onscroll = function(){
                if(850 < $(document).scrollTop()){   //原值800
                    $('.nav_Sidebar').fadeIn('slow');  
                }
                // if(2500 > $(document).scrollTop()){   //原值800
                //     $('.nav_Sidebar').fadeOut('slow');  

                else{
                    $('.nav_Sidebar').fadeOut('slow');
                }
                $('.home-standard-layout').each(function(index){
                    var that = $(this);
                    that.index = index;
                    if($(document).scrollTop() + $(window).height()/2 > that.offset().top){
                        _arr.push(index);
                    }
                });
                if(_arr.length){
                    $('.nav_Sidebar a').eq(_arr[_arr.length-1]).css({'backgroundImage':'url('+SHOP_SITE_URL+'/templates/default/images/home-nav-icon-hover.png)'}).addClass('current').siblings().css({'backgroundImage':'url('+SHOP_SITE_URL+'/templates/default/images/home-nav-icon.png)'}).removeClass('current');
                    _arr = [];
                }
            }
            $('.nav_Sidebar a').each(function(index){
                $(this).click(function(){
                    $('html,body').animate({scrollTop: $('.home-standard-layout').eq(index).offset().top - 20 + 'px'}, 1000);
                }).mouseover(function(){                                                       //原值.top-20   500
                    if($(this).hasClass('current')){
                        return;
                    }else{
                        $(this).css({'backgroundImage':'url('+SHOP_SITE_URL+'/templates/default/images/home-nav-icon-hover2.png)'});
                    }
                }).mouseout(function(){
                    if($(this).hasClass('current')){
                        return;
                    }else{
                        $(this).css({'backgroundImage':'url('+SHOP_SITE_URL+'/templates/default/images/home-nav-icon.png)'});
                    }
                });
            });

            window.onload = window.onresize = function(){
                if($(window).width() < 1100 || 800 > $(document).scrollTop()){  //原值1300 800
                    $('.nav_Sidebar').fadeOut('slow');
                }else{
                    $('.nav_Sidebar').fadeIn('slow');
                }

            }
                        /*end*/

 楼主| lhlt138 发表于 2016-9-13 15:54:28
shopwt 发表于 2016-9-13 14:52
点击返回顶部的代码换为其它的,不要原来的哪种。

js冲突吗??
 楼主| lhlt138 发表于 2016-9-13 15:50:50
shopwt 发表于 2016-9-13 14:52
点击返回顶部的代码换为其它的,不要原来的哪种。

不是很明白,回到顶部的是在右侧
shopwt 发表于 2016-9-13 14:52:42
点击返回顶部的代码换为其它的,不要原来的哪种。
 楼主| lhlt138 发表于 2016-9-13 09:50:52
QQ图片20160913094737.png 导航到上部还有内容,怎么隐藏
您需要登录后才可以回帖 登录 | 注册

本版积分规则

推荐贴子

联系我们

产品及方案咨询:18076568990、0755-25823180

电子邮箱:web@shopwt.com、客服微信:shopwtcom

公司地址:深圳市罗湖区人民南路3002号国贸大厦B座1608楼

  • 官方公众号

  • 微信客服