Merge pull request #6224 from bugron/fix/auto-scroll_hotfix

Fix incorrect auto-scrolling logic
This commit is contained in:
Rex Schrader
2016-01-16 10:51:36 -08:00

View File

@ -267,10 +267,12 @@ $(document).ready(function() {
var lastChallenge = $('.sr-only').filter(function() { var lastChallenge = $('.sr-only').filter(function() {
return $(this).text() === ' Complete'; return $(this).text() === ' Complete';
}); });
if (lastChallenge.length) {
lastChallenge = lastChallenge[lastChallenge.length - 1]; lastChallenge = lastChallenge[lastChallenge.length - 1];
var scrollTo = $(lastChallenge).offset().top - 250; var scrollTo = $(lastChallenge).offset().top - 250;
$('html, body').scrollTop(scrollTo); $('html, body').scrollTop(scrollTo);
} }
}
// map // map
$('#nav-map-btn').on('click', () => { $('#nav-map-btn').on('click', () => {