Browse Source

#3430 Fixes issue with page scroll flickering due to bug in sticky when container height is defined by static sticky height

pull/5242/head
Jack Lukic 7 years ago
parent
commit
52dbc6288e
1 changed files with 4 additions and 3 deletions
  1. 7
      src/definitions/modules/sticky.js

7
src/definitions/modules/sticky.js

@ -286,7 +286,8 @@ $.fn.sticky = function(parameters) {
context.offset.left += scrollContext.left; context.offset.left += scrollContext.left;
} }
module.cache = { module.cache = {
fits : ( element.height < scrollContext.height ),
fits : (element.height <= scrollContext.height),
sameHeight : (element.height == context.height),
scrollContext : { scrollContext : {
height : scrollContext.height height : scrollContext.height
}, },
@ -467,6 +468,7 @@ $.fn.sticky = function(parameters) {
cachedPosition = scroll || $scroll.scrollTop(), cachedPosition = scroll || $scroll.scrollTop(),
cache = module.cache, cache = module.cache,
fits = cache.fits, fits = cache.fits,
sameHeight = cache.sameHeight,
element = cache.element, element = cache.element,
scrollContext = cache.scrollContext, scrollContext = cache.scrollContext,
context = cache.context, context = cache.context,
@ -486,8 +488,7 @@ $.fn.sticky = function(parameters) {
doesntFit = !fits, doesntFit = !fits,
elementVisible = (element.height !== 0) elementVisible = (element.height !== 0)
; ;
if(elementVisible) {
if(elementVisible && !sameHeight) {
if( module.is.initialPosition() ) { if( module.is.initialPosition() ) {
if(scroll.top >= context.bottom) { if(scroll.top >= context.bottom) {

Loading…
Cancel
Save