Created
December 11, 2015 02:00
-
-
Save anonymous/2174a74eec79f8a094b6 to your computer and use it in GitHub Desktop.
JS Bin [add your bin description] // source http://jsbin.com/soperupuxu
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="description" content="[add your bin description]"> | |
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css" /> | |
<script src="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js"></script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
<style id="jsbin-css"> | |
#map { | |
height: 400px; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="map"> | |
</div> | |
<script id="jsbin-javascript"> | |
var defaultOptions = { | |
center : [52.52, 13.42] | |
}; | |
var opts = { zoom : 8 }; | |
var initMap = function(opts){ | |
// extend passed options with the default options# | |
// if we pass { zoom : 12 }, options would be { zoom : 12, center : [52.52, 13.42] } | |
var options = L.Util.extend(opts, defaultOptions); | |
// initialize map | |
var map = L.map('map').setView([51.505, -0.09], options.zoom); | |
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', { | |
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors' | |
}).addTo(map); | |
L.marker([51.5, -0.09]).addTo(map) | |
.bindPopup('A pretty CSS3 popup.<br> Easily customizable.') | |
.openPopup(); | |
}; | |
initMap(opts); | |
</script> | |
<script id="jsbin-source-css" type="text/css">#map { | |
height: 400px; | |
}</script> | |
<script id="jsbin-source-javascript" type="text/javascript">var defaultOptions = { | |
center : [52.52, 13.42] | |
}; | |
var opts = { zoom : 8 }; | |
var initMap = function(opts){ | |
// extend passed options with the default options# | |
// if we pass { zoom : 12 }, options would be { zoom : 12, center : [52.52, 13.42] } | |
var options = L.Util.extend(opts, defaultOptions); | |
// initialize map | |
var map = L.map('map').setView([51.505, -0.09], options.zoom); | |
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', { | |
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors' | |
}).addTo(map); | |
L.marker([51.5, -0.09]).addTo(map) | |
.bindPopup('A pretty CSS3 popup.<br> Easily customizable.') | |
.openPopup(); | |
}; | |
initMap(opts); | |
</script></body> | |
</html> |
This file contains hidden or 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
#map { | |
height: 400px; | |
} |
This file contains hidden or 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
var defaultOptions = { | |
center : [52.52, 13.42] | |
}; | |
var opts = { zoom : 8 }; | |
var initMap = function(opts){ | |
// extend passed options with the default options# | |
// if we pass { zoom : 12 }, options would be { zoom : 12, center : [52.52, 13.42] } | |
var options = L.Util.extend(opts, defaultOptions); | |
// initialize map | |
var map = L.map('map').setView([51.505, -0.09], options.zoom); | |
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', { | |
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors' | |
}).addTo(map); | |
L.marker([51.5, -0.09]).addTo(map) | |
.bindPopup('A pretty CSS3 popup.<br> Easily customizable.') | |
.openPopup(); | |
}; | |
initMap(opts); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment