Skip to content

Instantly share code, notes, and snippets.

@dpmango
Created July 19, 2017 12:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dpmango/ba91b315962c1118bdab02c7067b2c96 to your computer and use it in GitHub Desktop.
Save dpmango/ba91b315962c1118bdab02c7067b2c96 to your computer and use it in GitHub Desktop.
Stop's fixed element on the bottom of the page (before footer)
_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