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

Fix incorrect auto-scrolling logic
pull/6211/head
Rex Schrader 2016-01-16 10:51:36 -08:00
commit 95cd835114
1 changed files with 5 additions and 3 deletions

View File

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