传单地图未在平板电脑和移动设备上加载

时间:2018-10-14 10:41:02

标签: javascript jquery web leaflet

我在比桌面小得多的屏幕上渲染传单时遇到问题, 谁能帮我解决这个问题,这就是我如何尝试构建和使用我的地图

var cities = L.layerGroup(locationArray);
            var mbUrl = 'https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=blablahblah';
            var grayscale = L.tileLayer(mbUrl, {id: 'mapbox.light'}),
                streets = L.tileLayer(mbUrl, {id: 'mapbox.streets'});
            if(map) {
                map.remove();
            }
            map = L.map('searchMap', {
                center: [
                    35.7011398,
                    51.3892971
                ],
                zoom: 5,
                layers: [streets, cities]
            });
            var baseLayers = {
                "Grayscale": grayscale,
                "Streets": streets
            };
            var overlays = {
                "Cities": cities
            };
            L.control.layers(baseLayers, overlays).addTo(map);
            //Check Location exist

            if(locationArrayBound.length) {
                //Fit Bounds
                map.fitBounds(locationArrayBound).setMaxZoom(15);

            }

0 个答案:

没有答案