From a4f4faf803dfc0c66d303fe215ccb81ee915deb5 Mon Sep 17 00:00:00 2001 From: Kravimir Date: Wed, 14 Mar 2018 21:28:28 -0400 Subject: [PATCH] Conditionally set the CSS "top" property. The "top" property was being reset to 0 for the ".tableFloatingHeaderOriginal" element so many of the times that toggleHeaders() was called and then being set again via setPositionValues(). Now the element doesn't "jump" unexpectedly. --- js/jquery.stickytableheaders.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/js/jquery.stickytableheaders.js b/js/jquery.stickytableheaders.js index 4d742f1..bf51ef9 100644 --- a/js/jquery.stickytableheaders.js +++ b/js/jquery.stickytableheaders.js @@ -163,13 +163,15 @@ if (scrolledPastTop && notScrolledPastBottom) { newLeft = offset.left - scrollLeft + base.options.leftOffset; - base.$originalHeader.css({ + var styles={ 'position': 'fixed', 'margin-top': base.options.marginTop, - 'top': 0, 'left': newLeft, 'z-index': base.options.zIndex - }); + }; + if(base.$originalHeader.get(0).styles.top=='') + styles.top=0; + base.$originalHeader.css(styles); base.leftOffset = newLeft; base.topOffset = newTopOffset; base.$clonedHeader.css('display', '');