Created
December 17, 2013 12:41
-
-
Save Kamapcuc/8004337 to your computer and use it in GitHub Desktop.
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
<html> | |
<head> | |
<script src="http://api-maps.yandex.ru/2.1.3/?load=package.standard,package.route&lang=ru-RU" type="text/javascript"> </script> | |
<script type="text/javascript"> | |
ymaps.ready(init); | |
var I_HEIGHT = 36; | |
var I_WIDTH = 30; | |
var myCollection; | |
function init () { | |
var myMap = new ymaps.Map("map", { | |
center: [56.5633,52.99694], | |
zoom: 10, | |
behaviors: ['default', 'scrollZoom'] | |
}); | |
ymaps.option.presetStorage.add('my#template', { | |
iconLayout: 'default#image', | |
iconImageSize: [ I_WIDTH, I_HEIGHT ], | |
iconImageOffset: [ - I_WIDTH / 2, 1 - I_HEIGHT ] | |
} ); | |
ymaps.option.presetStorage.add('my#shop', { | |
preset: 'my#template', | |
iconImageHref: 'http://www.sportmaster.ru/bitrix/templates/pagemaster_2011/images/filter4.png' | |
} ); | |
ymaps.option.presetStorage.add('my#shop-disabled', { | |
preset: 'my#template', | |
iconImageHref: 'http://www.sportmaster.ru/bitrix/templates/pagemaster_2011/images/filter1.png' | |
} ); | |
myCollection = new ymaps.GeoObjectCollection(); | |
//вариант 1 | |
//myCollection.add(new ymaps.Placemark([37.61, 55.75], {}, {preset : 'my#shop-disabled'})); | |
//myCollection.add(new ymaps.Placemark([13.38, 52.51], {}, {preset : 'my#shop-disabled'})); | |
//myCollection.add(new ymaps.Placemark([30.30, 50.27], {}, {preset : 'my#shop-disabled'})); | |
//вариант 1 | |
//вариант 2 | |
myCollection.add(new ymaps.Placemark([37.61, 55.75], {}, {})); | |
myCollection.add(new ymaps.Placemark([13.38, 52.51], {}, {})); | |
myCollection.add(new ymaps.Placemark([30.30, 50.27], {}, {})); | |
myCollection.options.set("preset", "my#shop-disabled"); | |
//вариант 2 | |
myCollection.events.add("mouseenter", function () { | |
myCollection.options.set("preset", "my#shop"); | |
console.log('mouseenter'); | |
}), | |
myCollection.events.add("mouseleave", function () { | |
myCollection.options.set("preset", 'my#shop-disabled'); | |
}); | |
myMap.geoObjects.add(myCollection); | |
myMap.setBounds(myCollection.getBounds()); | |
} | |
</script> | |
</head> | |
<body> | |
<div id="map" style="width:1000px; height:800px"></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment