Browse Source

Related #2605, sticky no longer uses bottomPadding for determining bottom edge of context. This is counterintuitive and in most cases wrong

pull/2616/merge
jlukic 9 years ago
parent
commit
253bdc5c53
1 changed files with 10 additions and 7 deletions
  1. 17
      src/definitions/modules/sticky.js

17
src/definitions/modules/sticky.js

@ -237,8 +237,7 @@ $.fn.sticky = function(parameters) {
},
context = {
offset : $context.offset(),
height : $context.outerHeight(),
bottomPadding : parseInt($context.css('padding-bottom'), 10)
height : $context.outerHeight()
},
container = {
height: $container.outerHeight()
@ -260,8 +259,7 @@ $.fn.sticky = function(parameters) {
context: {
top : context.offset.top,
height : context.height,
bottomPadding : context.bottomPadding,
bottom : context.offset.top + context.height - context.bottomPadding
bottom : context.offset.top + context.height
}
};
module.set.containerSize();
@ -457,8 +455,14 @@ $.fn.sticky = function(parameters) {
}
else if(scroll.top > element.top) {
module.debug('Element passed, fixing element to page');
module.fixTop();
if( (element.height + scroll.top - elementScroll) > context.bottom ) {
module.bindBottom();
}
else {
module.fixTop();
}
}
}
else if( module.is.fixed() ) {
@ -542,8 +546,7 @@ $.fn.sticky = function(parameters) {
$module
.css({
left : '',
top : '',
marginBottom : module.cache.context.bottomPadding
top : ''
})
.removeClass(className.fixed)
.removeClass(className.top)

Loading…
Cancel
Save