Skip to content

Commit

Permalink
Make sure sticky does not reflow when setting same scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
jlukic committed May 20, 2015
1 parent 6bb04f6 commit ddd8f79
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/definitions/modules/sticky.js
Expand Up @@ -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', '')
Expand Down Expand Up @@ -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() ) {
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit ddd8f79

Please sign in to comment.