Merge pull request #6221 from bugron/fix/auto-scroll_to-the-last-completed_challenge

Auto-scroll the map to the last completed challenge
This commit is contained in:
Rex Schrader
2016-01-16 09:44:22 -08:00

View File

@ -263,6 +263,15 @@ $(document).ready(function() {
window.location.href = link;
});
if ($('.sr-only').length) {
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);
}
// map
$('#nav-map-btn').on('click', () => {
if (!main.isMapAsideLoad) {