Answer the question
In order to leave comments, you need to log in
How to work with leaflet in chrome?
Hello. I'm using leaflet js, works fine everywhere except Chrome Version 33; At a certain zoom, the picture is not displayed.
<script>
var h = document.getElementsByTagName('body')[0].offsetHeight;
document.getElementById('map').style.height = h+'px';
var w = document.getElementsByTagName('body')[0].offsetWidth;
document.getElementById('map').style.width = w+'px';
var map = L.map('map', {
maxZoom: 4,
minZoom: 1,
crs: L.CRS.Simple
}).setView([0, 0], 3);
var h1 = h/3;
var w2 = w/3;
map.setMaxBounds(new L.LatLngBounds([0,w2], [h1,0]));
var imageUrl = 'TyazhmashPlanshema.jpg'
var imageBounds = ;
L.imageOverlay(imageUrl, imageBounds).addTo(map);
</script>
Answer the question
In order to leave comments, you need to log in
html, body, #map {
margin: 0;
padding: 0;
height: 100%;
width: 100%
}
</style>
<body>
<div id="map"></div>
<script>
var maxZoom = 6;
var imageWidth = 7022;
var imageHeight = 4964;
var tile = {
w: imageWidth/maxZoom,
h: imageHeight/maxZoom
};
var map = L.map('map', {
maxZoom: 2,
minZoom: 0,
crs: L.CRS.Simple
}).setView([0, 0], 0);
map.setMaxBounds(new L.LatLngBounds([0,tile.w], [tile.h,0]));
var imageUrl = '12.jpg'
var imageBounds = ;
L.imageOverlay(imageUrl, imageBounds).addTo(map);
</script>
</body>
</html>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question