K
K
kirawa2014-04-07 09:51:47
leaflet
kirawa, 2014-04-07 09:51:47

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

3 answer(s)
D
Dron Krzh, 2014-04-07
@ walkman7

Chrome 33.0.1750.152 everything works
jsfiddle.net/TRwU5

K
kirawa, 2014-04-07
@kirawa

Version 33.0.1750.117 m is
not working

K
kirawa, 2014-04-07
@kirawa

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>

here is my code

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question