Auto-scroll the map to the last completed challenge

This commit is contained in:
Arsen Melikyan
2016-01-16 21:30:47 +04:00
parent 9f76f5e467
commit 6b0c41f616

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) {