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,9 +267,11 @@ $(document).ready(function() {
var lastChallenge = $('.sr-only').filter(function() { var lastChallenge = $('.sr-only').filter(function() {
return $(this).text() === ' Complete'; return $(this).text() === ' Complete';
}); });
lastChallenge = lastChallenge[lastChallenge.length - 1]; if (lastChallenge.length) {
var scrollTo = $(lastChallenge).offset().top - 250; lastChallenge = lastChallenge[lastChallenge.length - 1];
$('html, body').scrollTop(scrollTo); var scrollTo = $(lastChallenge).offset().top - 250;
$('html, body').scrollTop(scrollTo);
}
} }
// map // map