Javascript 单张在渲染贴图时显示旋转

Javascript 单张在渲染贴图时显示旋转,javascript,leaflet,Javascript,Leaflet,我试图在等待贴图上渲染层时显示旋转,但由于某些原因,旋转器不工作 代码如下: <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" /> <script type='text/javascript' src="http://makinacorpus.github.io/Leaflet.Spin/leaflet.spin.js"></script> <s

我试图在等待贴图上渲染层时显示旋转,但由于某些原因,旋转器不工作

代码如下:

<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />
<script type='text/javascript' src="http://makinacorpus.github.io/Leaflet.Spin/leaflet.spin.js"></script>
<script type='text/javascript' src="http://makinacorpus.github.io/Leaflet.Spin/spin.js/dist/spin.min.js"></script>

<a href="#" onclick="showMap('http://{s}.tile.thunderforest.com/landscape/{z}/{x}/{y}.png')">TF.Landscape</a>&nbsp;|<a href="#" onclick="showMap('http://{s}.tile.thunderforest.com/outdoors/{z}/{x}/{y}.png')">TF.Outdoors</a>
<div id="map" style="width: 640px; height: 480px"></div>

<script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet.js"> </script>
<script>
    var map;
    var tileLayer;
    function showMap (layerURL) {
        if(!map) { 
          map = L.map('map').setView([19.5, -73], 7); 
        }

        tileLayer = L.tileLayer(layerURL, {
              attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a>',
              maxZoom: 18
        });

        map.spin(true);
            setTimeout(function () {
                map.addLayer(tileLayer);    
                map.spin(false);
           }, 3000);
    }
</script>

|
var映射;
var tileLayer;
功能显示图(layerURL){
如果(!map){
map=L.map('map').setView([19.5,-73],7);
}
tileLayer=L.tileLayer(layerURL{
属性:“地图数据©;”,
最大缩放:18
});
map.spin(真);
setTimeout(函数(){
map.addLayer(tileLayer);
map.spin(假);
}, 3000);
}

加载传单后加载旋转库。js:

<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />

<a href="#" onclick="showMap('http://{s}.tile.thunderforest.com/landscape/{z}/{x}/{y}.png')">TF.Landscape</a>&nbsp;|<a href="#" onclick="showMap('http://{s}.tile.thunderforest.com/outdoors/{z}/{x}/{y}.png')">TF.Outdoors</a>
<div id="map" style="width: 640px; height: 480px"></div>
<script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet.js"> </script
<script type='text/javascript' src="http://makinacorpus.github.io/Leaflet.Spin/leaflet.spin.js"></script>
<script type='text/javascript' src="http://makinacorpus.github.io/Leaflet.Spin/spin.js/dist/spin.min.js"></script>
...

|

“不工作”是什么意思?它在地图加载时不显示旋转图像现在显示旋转图像,但在地图加载完成时它不会消失。在a中尝试过-对我来说很好,加载时旋转显示,在地图显示时消失。我如何将此与R结合使用?