2016-06-16 14 views
3

Ich habe mit jsfiddle versucht, ein laufendes Beispiel zu erstellen, das Flugblatt verwendet.wie man eine jfiddle mit Flugblatt erstellen

, weil ich nicht erfolgreich war ich für einige Beispiele gesucht und gefunden, die auf folgende Arbeiten:

ich kopiert dann das Beispiel in einer neuen Geige

aber es funktioniert immer noch nicht ...

wenn die externen Ressourcen eingesetzt wird, gab es die folgende Fehlermeldung:

jsfiddle.net says:

You're loading resources over HTTP not HTTPS, your fiddle will not work. Do you wish to continue?

irgendwelche Vorschläge, was hier falsch ist?

P. S .: unten ist der Code der jsfiddle Fenster:

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 = '&copy; <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); 
+1

Beachten Sie, dass Sie JSFiddle einfach durch "http" anstelle von "https" laden können, wie in Ihrem ersten Link. – ghybs

+0

guten Fang! habe das nicht bemerkt! Vielen Dank! in der Tat macht es Sinn, dies zu tun, falls keine https-Repositories verfügbar sind! – udo

Antwort

Verwandte Themen