Created
October 14, 2019 06:53
-
-
Save webag/cd354113344e058398cce167bfb54927 to your computer and use it in GitHub Desktop.
Загрузка карты по waypoint. Map waypoint load
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function initMap(){ | |
let myMap = new ymaps.Map("map", { | |
center: [55.76, 37.64], | |
zoom: 7 | |
}); | |
} | |
$(function($){ | |
function addScript(src) { | |
let s = document.createElement('script'); | |
s.setAttribute('src', src); | |
document.body.appendChild(s); | |
} | |
const geoSection = $('.s-map'); | |
if (geoSection.length){ | |
geoSection.waypoint(function () { | |
addScript('https://api-maps.yandex.ru/2.1/?apikey=fc8e2c55-0d43-4696-a7a9-853c1b80e268&lang=ru_RU&onload=initMap'); | |
this.destroy(); | |
}, { | |
offset: '100%' | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment