Created
April 11, 2014 12:02
-
-
Save ilyaashapatov/10462511 to your computer and use it in GitHub Desktop.
fancybox & yandex maps
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
<script type="text/javascript" src="http://yandex.st/jquery/1.11.0/jquery.min.js"></script> | |
<script type="text/javascript" src="http://fancyapps.com/fancybox/source/jquery.fancybox.js"></script> | |
<script type="text/javascript" src="http://fancyapps.com/fancybox/source/jquery.fancybox.js"></script> | |
<script type="text/javascript" src="http://api-maps.yandex.ru/2.0/?load=package.full&lang=ru-RU"></script> | |
<link type='text/css' href='http://fancyapps.com/fancybox/source/jquery.fancybox.css' rel='stylesheet'> | |
// created element | |
<div id="map_popup" style="width:100%; height: 100%; display: none;"></div> | |
// created link | |
<a href="#map_popup" class="linkmap">Схема проезда</a> | |
// init ya map to $(document).ready | |
<sctipt type="text/javascript"> | |
(function(){ | |
ymaps.ready(function () { | |
var myMap, myPlacemark; | |
$('.linkmap').fancybox({ | |
maxWidth : 880, | |
maxHeight : 700, | |
padding : 50, | |
// fitToView : false, | |
width : '90%', | |
height : '90%', | |
autoSize : false, | |
closeClick : false, | |
afterShow : function() { | |
myMap = new ymaps.Map('map_popup', { | |
center: [59.214652, 39.872766], | |
zoom: 17 | |
}); | |
var myPlacemark = new ymaps.Placemark([59.214652, 39.872766], { | |
balloonContent: 'Компания «ТриЛан Вологда»' | |
}, { | |
// iconImageHref: '/assets/templates/main/img/map-ico2.png', // link image icon | |
// iconImageSize: [100, 50], // size image | |
// iconImageOffset: [-80, -60] // position image | |
}); | |
// add balloon to map | |
myMap.geoObjects.add(myPlacemark); | |
myMap.controls.add('zoomControl', { top: 5, right: 5 }); // add zoom control to map, and positon | |
myMap.controls.add('miniMap', { bottom: 5, left: 5 }); // add mini map | |
myMap.controls.add('routeEditor', { top: 5, left: 5 }); // add route Editor | |
}, | |
afterClose:function (){ | |
myMap.destroy(); | |
myMap = null; | |
} | |
}); | |
}); | |
}()) | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment