Skip to content

Instantly share code, notes, and snippets.

@janit
Created July 5, 2015 18:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save janit/128bf3956e96ede5941a to your computer and use it in GitHub Desktop.
Save janit/128bf3956e96ede5941a to your computer and use it in GitHub Desktop.
<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