Created
July 19, 2017 12:26
-
-
Save dpmango/ba91b315962c1118bdab02c7067b2c96 to your computer and use it in GitHub Desktop.
Stop's fixed element on the bottom of the page (before footer)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_window.scrolled(10, function () { | |
var stickyEl = $('.results__map'); | |
var windowBottomScroll = _window.scrollTop() + _window.height(); | |
var stopPoint = _document.height() - $('footer').outerHeight(); | |
if (windowBottomScroll >= stopPoint) { | |
stickyEl.addClass('results__map--stop'); | |
} else if (windowBottomScroll < stopPoint) { | |
stickyEl.removeClass('results__map--stop'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment