简体   繁体   English

滚动固定的导航高度百分比

[英]scroll fixed navigation height percent

I am trying to fix my vertical navigation on the left side of my site. 我正在尝试将垂直导航固定在网站的左侧。

$(document).ready(function(){

    $(window).scroll(function(){
        var border = 150;
        if($(window).scrollTop() >= border){
            $("#box_CATEGORIES").css({
                    'position' : 'fixed',
                    'top' : '0'

            });
        }
        if($(window).scrollTop() < border){
            $('#box_CATEGORIES').removeAttr('style');
        }
    })

});

This worked first fine but now I changed the height of my site in 100% because i want the footer always on bottom of the site. 这项工作起初很好,但现在我将网站的高度更改为100%因为我希望页脚始终位于网站底部。

And because of that ( I think ) the code doesnt work anymore.. :( any help? 由于这个原因(我认为),代码不再起作用.. :(有帮助吗?

The solution is to remove the overflow-x:hidden from the body element. 解决方案是从body元素中删除overflow-x:hidden。

@James Khoury answered on similar Question by: @James Khoury在类似问题上的回答是:

If you are using visible for either overflow-x or overflow-y and something other than visible for the other. 如果您对overflow-x或overflow-y使用了visible,而对其他对象则不可见。 The visible value is interpreted as auto. 可见值被解释为自动。

Also you can find this jQuery open issue on github 您也可以在github上找到此jQuery开放问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM