Skip to content

Commit

Permalink
Related #2605, sticky no longer uses bottomPadding for determining bo…
Browse files Browse the repository at this point in the history
…ttom edge of context. This is counterintuitive and in most cases wrong
  • Loading branch information
jlukic committed Jul 13, 2015
1 parent b61fef3 commit 253bdc5
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/definitions/modules/sticky.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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();
Expand Down Expand Up @@ -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() ) {

Expand Down Expand Up @@ -542,8 +546,7 @@ $.fn.sticky = function(parameters) {
$module
.css({
left : '',
top : '',
marginBottom : module.cache.context.bottomPadding
top : ''
})
.removeClass(className.fixed)
.removeClass(className.top)
Expand Down

0 comments on commit 253bdc5

Please sign in to comment.