diff --git a/src/definitions/modules/sticky.js b/src/definitions/modules/sticky.js index 40d2e7702..e965db79c 100644 --- a/src/definitions/modules/sticky.js +++ b/src/definitions/modules/sticky.js @@ -210,6 +210,9 @@ $.fn.sticky = function(parameters) { lastScroll: function(scroll) { module.lastScroll = scroll; }, + elementScroll: function(scroll) { + module.elementScroll = scroll; + }, positions: function() { var window = { @@ -281,6 +284,9 @@ $.fn.sticky = function(parameters) { ; }, currentElementScroll: function() { + if(module.elementScroll) { + return module.elementScroll; + } return ( module.is.top() ) ? Math.abs(parseInt($module.css('top'), 10)) || 0 : Math.abs(parseInt($module.css('bottom'), 10)) || 0 @@ -295,8 +301,7 @@ $.fn.sticky = function(parameters) { delta = module.get.scrollChange(scroll), maxScroll = (element.height - window.height + settings.offset), elementScroll = module.get.currentElementScroll(), - possibleScroll = (elementScroll + delta), - elementScroll + possibleScroll = (elementScroll + delta) ; if(module.cache.fits || possibleScroll < 0) { elementScroll = 0; @@ -415,6 +420,7 @@ $.fn.sticky = function(parameters) { // save current scroll for next run module.save.lastScroll(scroll.top); + module.save.elementScroll(elementScroll); if(elementVisible) {