Browse Source

Make sure sticky does not reflow when setting same scroll

pull/2300/head
jlukic 9 years ago
parent
commit
ddd8f796a2
1 changed files with 7 additions and 4 deletions
  1. 11
      src/definitions/modules/sticky.js

11
src/definitions/modules/sticky.js

@ -347,6 +347,9 @@ $.fn.sticky = function(parameters) {
}, },
scroll: function(scroll) { scroll: function(scroll) {
module.debug('Setting scroll on element', scroll); module.debug('Setting scroll on element', scroll);
if(module.elementScroll == scroll) {
return;
}
if( module.is.top() ) { if( module.is.top() ) {
$module $module
.css('bottom', '') .css('bottom', '')
@ -418,10 +421,6 @@ $.fn.sticky = function(parameters) {
elementVisible = (element.height !== 0) elementVisible = (element.height !== 0)
; ;
// save current scroll for next run
module.save.lastScroll(scroll.top);
module.save.elementScroll(elementScroll);
if(elementVisible) { if(elementVisible) {
if( module.is.initialPosition() ) { 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() { bindTop: function() {

Loading…
Cancel
Save