In my jQuery code, I don't want the window to scroll to the top when my wrapper is set to overflow:hidden.
$('#shownav').click(function(event) {
$('#wrapper').toggleClass('noscroll');
return false;
});
Here's the HTML:
<div id="shownav"> navigation </div>
<div id="wrapper"> long content </div>
And here's the CSS:
.noscroll {overflow:hidden;}
The navigation has position:fixed;
And the wrapper has position:relative;
and width:100%; height:100%;
However, when I click #shownav after scrolling down the long content, the content scrolls back to the top as if scrollTop(0). How can I prevent this from happening?