From 253bdc5c53aae3132715c103abc2a48461b11eae Mon Sep 17 00:00:00 2001 From: jlukic Date: Mon, 13 Jul 2015 18:30:36 -0400 Subject: [PATCH] Related #2605, sticky no longer uses bottomPadding for determining bottom edge of context. This is counterintuitive and in most cases wrong --- src/definitions/modules/sticky.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/definitions/modules/sticky.js b/src/definitions/modules/sticky.js index 446fa94ad..0bf854a17 100644 --- a/src/definitions/modules/sticky.js +++ b/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)