Peiwen
Peiwen

Reputation: 692

min-height for jquery tabs will affect page automatically scroll

here is my code

http://jsfiddle.net/aSCDp/5/

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

Answers (2)

Stano
Stano

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

menislici
menislici

Reputation: 1167

You can set an anchor to the bottom of the DOM, make the colors names links and point each of them to the bottom anchor. JSFiddle

Upvotes: 0

Related Questions