mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-09-24 23:01:18 +08:00
Fix incorrect auto-scrolling logic
This commit is contained in:
+5
-3
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user