如何使用传单创建jsfiddle
我正在努力尝试使用jsfiddle创建一个使用传单的运行示例。
因为我没有成功,我搜索了一些例子,发现以下一个工作:
然后我将这个例子复制到一个新的小提琴中
但它仍然不工作...
当插入外部资源时,出现以下错误:
jsfiddle.net说:
你通过HTTP加载资源而不是HTTPS,你的小提琴将无法工作。 你想继续吗?
任何建议这里有什么错误?
ps:下面是jsfiddle窗口的代码:
HTML:
<div id="map"></div>
CSS:
#map {
    height: 500px;
    width: 80%;
}
JAVASCRIPT:
// We’ll add a tile layer to add to our map, in this case it’s a OSM tile layer.
// Creating a tile layer usually involves setting the URL template for the tile images
var osmUrl = 'http://{s}.tile.osm.org/{z}/{x}/{y}.png',
      osmAttrib = '© <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors',
      osm = L.tileLayer(osmUrl, {
        maxZoom: 18,
        attribution: osmAttrib
      });
// initialize the map on the "map" div with a given center and zoom
var map = L.map('map').setView([19.04469, 72.9258], 12).addLayer(osm);
// Script for adding marker on map click
function onMapClick(e) {
var marker = L.marker(e.latlng, {
    draggable: true,
    title: "Resource location",
    alt: "Resource Location",
    riseOnHover: true
    }).addTo(map)
    .bindPopup(e.latlng.toString()).openPopup();
    // Update marker on changing it's position
    marker.on("dragend", function(ev) {
    var chagedPos = ev.target.getLatLng();
    this.bindPopup(chagedPos.toString()).openPopup();
    });
    }
    map.on('click', onMapClick);
传单CDN尚不支持SSL。 你可以使用不需要https的东西,比如操作单张,这只是JSBin的一个分支,可以轻松选择传单库。
或者,您可以使用支持https的cdnjs.net中的Leaflet。
链接地址: http://www.djcxy.com/p/72089.html