From ddd8f796a2690dbe6c49dadb30fcfd139bb1cee9 Mon Sep 17 00:00:00 2001 From: jlukic Date: Wed, 20 May 2015 18:49:14 -0400 Subject: [PATCH] Make sure sticky does not reflow when setting same scroll --- src/definitions/modules/sticky.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/definitions/modules/sticky.js b/src/definitions/modules/sticky.js index 5c2ea1bd8..a3fc7ed84 100644 --- a/src/definitions/modules/sticky.js +++ b/src/definitions/modules/sticky.js @@ -347,6 +347,9 @@ $.fn.sticky = function(parameters) { }, scroll: function(scroll) { module.debug('Setting scroll on element', scroll); + if(module.elementScroll == scroll) { + return; + } if( module.is.top() ) { $module .css('bottom', '') @@ -418,10 +421,6 @@ $.fn.sticky = function(parameters) { elementVisible = (element.height !== 0) ; - // save current scroll for next run - module.save.lastScroll(scroll.top); - module.save.elementScroll(elementScroll); - if(elementVisible) { if( module.is.initialPosition() ) { @@ -487,6 +486,10 @@ $.fn.sticky = function(parameters) { } } } + + // save current scroll for next run + module.save.lastScroll(scroll.top); + module.save.elementScroll(elementScroll); }, bindTop: function() {