Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- (function(){
- ymaps.ready(function(){ return false })
- })();
- let yMapsIsShown = false;
- let myMap;
- function init(){
- console.log("map init")
- myMap = new ymaps.Map ("map", {
- center: [55.76, 37.64],
- zoom: 7
- });
- }
- $(window).scroll(function() {
- if(!yMapsIsShown) {
- if ($(window).height() + $(window).scrollTop() > $(".b-map").offset().top) {
- yMapsIsShown = true;
- ymaps.ready(init);
- }
- }
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement