自作MAPをgoogleMapみたいに

 

 
<iframe class="mapillare" src="./zoom_map.html" width=100% frameborder=0></iframe>
<!DOCTYPE html>
<meta charset="utf-8">
<style>
html,body {
margin: 0;
width: 100%;
height: 100%;
overflow: hidden;
background: white;
}
.mapfr{width: 100%;
}
</style>
<body>
<script src="js/d3.v3.min.js" charset="utf-8"></script>
<script>
var zoom = d3.behavior.zoom()
.scale(1)
.scaleExtent([.1, 10])
.on("zoom", zoomed);

var svg = d3.select("body")
.call(zoom);

function zoomed() {
var t = "translate(" + d3.event.translate[0] + 'px,' + d3.event.translate[1] +"px) " +
"scale(" + d3.event.scale + ',' + d3.event.scale + ")";
d3.select("img")
.style("transform-origin", "0 0")
.style("-moz-transform-origin", "0 0")
.style("-webkit-transform-origin", "0 0")
.style("-o-transform-origin", "0 0")
.style("-ms-transform-origin", "0 0")
.style("transform", t)
.style("-moz-transform", t)
.style("-webkit-transform", t)
.style("-o-transform", t)
.style("-ms-transform", t);
}
</script>
<img class="mapfr" src="img/mapillare.svg">
</body>


 

Categories:

Tags: