필자는 Webkit 브라우저 (Chrome 및 Safari)에서 완벽하게 작동하는 일부 JavaScript/jQuery 코드에 난처하지만 Firefox 또는 IE에서 전혀 작동하지 않으며 누군가 내 오류를 지적 할 수 있기를 희망합니다.jQuery는 Chrome 및 Safari에서 작동하지만 Firefox 또는 IE에서 작동하지 않습니까?
내가하고있는 일은 jQuery로 GeoRSS 피드를 가져 와서 전단지를 사용하여지도에서 위치 지점을 플로팅하는 것입니다. 어쨌든 포인트는 파이어 폭스 또는 IE를 사용할 때 플롯되지 않습니다? http://bit.ly/19N0I75
을 그리고 여기에 코드입니다 : 여기에 해당 페이지의
var map = L.mapbox.map('map', 'primitive.geography-class').setView([42, 22], 4);
var wordpressIcon = L.icon({
iconUrl: 'http://www.shifting-sands.com/wp-content/themes/shiftingsands/images/icons/wordpress.png',
iconSize: [18, 18], // size of the icon
shadowSize: [0, 0], // size of the shadow
iconAnchor: [9, 9], // point of the icon which will correspond to marker's location
shadowAnchor: [0, 0], // the same for the shadow
popupAnchor: [0, 0] // point from which the popup should open relative to the iconAnchor
});
jQuery(document).ready(function($){
$.get("http://shifting-sands.com/feed/", function (data) {
var $xml = $(data);
var $i = 0;
$xml.find("item").each(function() {
var $this = $(this),
item = {
title: $this.find("title").text(),
linkurl: $this.find("link").text(),
description: $this.find("description").text(),
pubDate: $this.find("pubDate").text(),
latitude: $this.find("lat").text(),
longitude: $this.find("long").text()
}
lat = item.latitude;
long = item.longitude;
title = item.title;
clickurl = item.linkurl;
//Get the url for the image.
var htmlString = '<h4><a href="' + clickurl + '" target="_blank">' + title + '</a></h4>';
var contentString = '<div id="content">' + htmlString + '</div>';
//Create a new marker position using the Leaflet API.
var rssmarker = L.marker([lat, long], {icon: wordpressIcon}).addTo(map);
//Create a new info window using the Google Maps API
rssmarker.bindPopup(contentString, {closeButton: true});
$i++;
});
});
});
감사합니다!
Firefox에서 작동 24 - mac –
"잘못된 LatLng 개체"? – adeneo
"오류 : 잘못된 LatLng 개체 : (,)"가 mapbox.js에 있습니다. 짐작할 수 있듯이 객체 리터럴의 마지막 속성 다음에 쉼표가 있습니다. –