Reputation: 692
here is my code
If you please scroll the page down to bottom, and click any links. The page will be automatically scrolled to top.
Is it possible to keep the page stationary when we click the links?
I thought the problem comes from the "min-height" of #container. If I set the "min-height" higher then #tab3, then there is no problem at all.
Moreover, if I replace " $('#tab' + k).fadeIn(500);" with "$('#tab' + k).show();" . The page will not be scrolled to top.
Could you help me to resolve this problem and keep the fadeIn effect?
Thanks
Upvotes: 0
Views: 395
Reputation: 8949
Another way is to fix window scroll offset. In your code:
var scrollTop = $(window).scrollTop();
$('.tabs').hide();
$('#tab' + k).fadeIn(500); //$('#tab' + k).show();
$(window).scrollTop(scrollTop);
Upvotes: 1