开发者

Scrolling Navigation gets stuck in IE?

开发者 https://www.devze.com 2023-01-04 01:19 出处:网络
I have a navigation in the top right corner that will scroll down a page with a user.I am using this jQuery code:

I have a navigation in the top right corner that will scroll down a page with a user. I am using this jQuery code:

开发者_Go百科
var $scrollingDiv = $("#scrollingDiv");
    $(window).scroll(function(){            
        $scrollingDiv
            .stop()
            .animate({"marginTop": ($(window).scrollTop() + 30) + "px"}, "fast" );  

    });

the CSS:

#scrollingDiv{background-color:#fff;margin-left:4%;margin-top:10px;padding:0 2% 2%;}

It works great, the Problem is: The navigation filters the content, so you can be at the bottom of the page, click on a link in the navigation and it will filter the content so there will only be 2 paragraphs instead of 20. The scrolling navigation will get STUCK on the bottom in IE. Other browsers it moves back to the top.

I tried using a

<a name="top"> </a>

But that didnt work. Any suggestions?


here is what you do:

$("a.nav").click(function () {
    $("#scrollingDiv").css({marginTop: '10px'}); 
    });

This will reset the marginTop so it won't get stuck on the bottom

0

精彩评论

暂无评论...
验证码 换一张
取 消