From bd31afea3c20e8107204f100649f1caeef8e7c4c Mon Sep 17 00:00:00 2001 From: Matt Vanderpol Date: Sat, 14 Jun 2014 08:34:27 -0700 Subject: [PATCH] Set height on container when not animating There is support during fade animation to set a height on the tabs container to prevent short pages from jumping back to the top when both tabs are hidden. This provides a similar feature to tabs that don't animate to avoid the same jump. --- lib/jquery.easytabs.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/jquery.easytabs.js b/lib/jquery.easytabs.js index d11c15e..eba7655 100644 --- a/lib/jquery.easytabs.js +++ b/lib/jquery.easytabs.js @@ -575,6 +575,11 @@ } } + // Need to preserve height if not animating to prevent jumping to top of browser with short content + if ( !settings.animate ) { + $panelContainer.css({ 'min-height': $panelContainer.height() }); + } + // Change the active tab *first* to provide immediate feedback when the user clicks plugin.tabs.filter("." + settings.tabActiveClass).removeClass(settings.tabActiveClass).children().removeClass(settings.tabActiveClass); plugin.tabs.filter("." + settings.collapsedClass).removeClass(settings.collapsedClass).children().removeClass(settings.collapsedClass);