Created
July 5, 2015 18:18
-
-
Save janit/128bf3956e96ede5941a 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
<ymap> | |
<div id="ymap{{ opts.mapid }}"></div> | |
<style scoped> | |
div { | |
width: 320px; | |
height: 240px; | |
} | |
</style> | |
<script> | |
// Define maps state, defaults | |
var mapReady = false; | |
var containerId = 'ymap'; | |
var center = [0,0]; | |
var zoom = 3; | |
if(typeof opts.mapid != 'undefined') { | |
containerId += opts.mapid; | |
} | |
if(typeof opts.center != 'undefined') { | |
center = opts.center.split(','); | |
} | |
if(typeof opts.zoom != 'undefined') { | |
zoom = opts.zoom; | |
} | |
this.on('mount', function() { | |
if(typeof opts.width != 'undefined') { | |
foo = document.getElementById(containerId).style.width=opts.width; | |
} | |
if(typeof opts.height != 'undefined') { | |
foo = document.getElementById(containerId).style.height=opts.height; | |
} | |
ymaps.ready(initMap); | |
}) | |
function initMap(){ | |
myMap = new ymaps.Map (containerId, { | |
center: center, | |
zoom: zoom | |
}); | |
} | |
</script> | |
</ymap> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment