传单.markrcluster onclick错误-无法执行'appendChild'在'节点&
Leaflet.markercluster onclick error - Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'
我正试图在点击.append
时调用一个函数——地图画布外的一些文本。文档中的这个例子似乎有我想要的,但我还没能成功地将它应用到我的项目中。
我尝试过的代码:
var tiles = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
maxZoom: 18,
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}),
latlng = L.latLng(60, -100);
var map = L.map('map', {center: latlng, zoom: 4, layers: [tiles]});
var progress = document.getElementById('progress');
var progressBar = document.getElementById('progress-bar');
function updateProgressBar(processed, total, elapsed, layersArray) {
if (elapsed > 1000) {
progress.style.display = 'block';
progressBar.style.width = Math.round(processed/total*100) + '%';
}
if (processed === total) {
progress.style.display = 'none';
}
}
var markers = L.markerClusterGroup({ chunkedLoading: true, chunkProgress: updateProgressBar });
var markerList = [];
function populate() {
getCoordinates(function (data) {
for (var i in data) {
var a = data[i];
var title = a.id;
var marker = L.marker(L.latLng(a.lat, a.lng), {title: title});
marker.bindPopup(title);
markers.addLayer(marker);
markerList.push(marker);
}
map.addLayer(markers);
});
}
这是Chrome控制台在使用传单1.0测试版点击标记时出现的错误:
Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.
L.Popup.L.Layer.extend._updateContent @ leaflet-src.js:4462
L.Popup.L.Layer.extend.update @ leaflet-src.js:4373
L.Popup.L.Layer.extend.onAdd @ leaflet-src.js:4308
L.Layer.L.Evented.extend._layerAdd @ leaflet-src.js:2534
L.Map.L.Evented.extend.whenReady @ leaflet-src.js:2382
L.Map.include.addLayer @ leaflet-src.js:2558
L.Map.include.openPopup @ leaflet-src.js:4592
L.Layer.include.openPopup @ leaflet-src.js:4684
L.Layer.include._openPopup @ leaflet-src.js:4746
L.Evented.L.Class.extend.fire @ leaflet-src.js:488
L.Map.L.Evented.extend._fireDOMEvent @ leaflet-src.js:2363
L.Map.L.Evented.extend._handleDOMEvent @ leaflet-src.js:2331handler @ leaflet-src.js:6945
错误由弹出窗口生成,与您的点击事件/处理程序无关。单击标记时,它的弹出窗口会尝试将其内容设置为未定义的title
变量。
相关文章:
- 节点导出返回一个空对象
- 可以前端maven插件使用节点,npm已经安装
- 在jstree中,如何将指定的节点集中到大型树上
- 节点Js:How to catch a“;没有这样的文件或目录“;读取线模块出错
- 收到错误:无法在“节点”上执行“appendChild”:参数 1 的类型不是“节点”
- appendChild上的错误-试图在不存在节点的上下文中引用该节点
- 1.js:23未捕获类型错误:执行'失败;appendChild'在'节点':参数1不是
- 无法在“节点”上执行“appendChild”:参数 1 的类型不是“节点”
- 收到错误:无法在“节点”上执行“appendChild”
- 错误:无法在“节点”上执行“appendChild”:参数 1 的类型不是“节点”
- HierarchyRequestError:无法执行'appendChild'在'节点'
- 传单.markrcluster onclick错误-无法执行'appendChild'在'节点&
- appendChild树节点不展开
- element.appendChild(node)是否将父节点的属性应用到子节点
- 为什么appendChild不能处理节点类型
- 节点.在<=IE9 (haven't checked 10)中,appendChild的行为不符合预期
- 节点的参数1.appendChild没有实现接口Node
- appendChild 不会将节点添加到子项列表的末尾
- appendChild 不会将节点添加到指定父节点的子节点列表的末尾
- 在appendchild参数中创建的节点没有执行