Browse Source

Fix issue with bound bottom conditions being hit when element is larger than context

pull/7005/head
Jack 4 years ago
parent
commit
47e4d95496
1 changed files with 2 additions and 2 deletions
  1. 4
      src/definitions/modules/sticky.js

4
src/definitions/modules/sticky.js

@ -438,7 +438,7 @@ $.fn.sticky = function(parameters) {
}, },
size: function() { size: function() {
if(module.cache.element.height !== 0 && module.cache.element.width !== 0) { if(module.cache.element.height !== 0 && module.cache.element.width !== 0) {
element.style.setProperty('width', module.cache.element.width + 'px', 'important');
element.style.setProperty('width', module.cache.element.width + 'px', 'important');
element.style.setProperty('height', module.cache.element.height + 'px', 'important'); element.style.setProperty('height', module.cache.element.height + 'px', 'important');
} }
} }
@ -501,7 +501,7 @@ $.fn.sticky = function(parameters) {
module.bindBottom(); module.bindBottom();
} }
else if(scroll.top > element.top) { else if(scroll.top > element.top) {
if( (element.height + scroll.top - elementScroll) >= context.bottom ) {
if((element.height + scroll.top - elementScroll) >= context.bottom && element.height < context.height) {
module.debug('Initial element position is bottom of container'); module.debug('Initial element position is bottom of container');
module.bindBottom(); module.bindBottom();
} }

Loading…
Cancel
Save