1 回答

TA貢獻(xiàn)1860條經(jīng)驗(yàn) 獲得超9個(gè)贊
通過分析換了一種方法解決
利用BootstrapTable這個(gè)onClickRow事件函數(shù) 然后在單獨(dú)調(diào)用google map的api
產(chǎn)生點(diǎn)擊循環(huán)列表在map中展現(xiàn)圖片信息
修復(fù)bug $element[0].addEventListener('click',fm);
function BootstrapTable() {
$.ajax({
"type": "get",
"url": imgJson,
"async": false,
"success": function (data) {
window.res = data.data;
//console.log(data.data);
$('#table').bootstrapTable({
data: data.data,
pagination: true,
searchAlign: "right",
buttonsAlign: "left",
showRefresh: true,
searchOnEnterKey: false,
singleSelect: true,
maintainSelected: false,
search: true,
pageSize: 10,
sortable: false,
paginationLoop: true,
toolbar: '#toolbar', // 工具欄ID
toolbarAlign: 'right', // 工具欄對(duì)齊方式
onClickRow: function (item, $element) {
var arr = {};
arr.Latitude = parseFloat(item.Latitude);
arr.Longitude = parseFloat(item.Longitude);
var latLng = new google.maps.LatLng(arr.Latitude, arr.Longitude);
var fm = mapLine.markerClickFunction(item, latLng);
$element[0].addEventListener('click',fm);
},
columns: [
{
field: 'id',
align: 'center',
title: 'id'
},
{
field: 'photo_title',
align: 'center',
title: 'photo_title'
},
{
field: 'photo_time',
align: 'center',
title: 'photo_time'
}
]
});
}
});
};
添加回答
舉報(bào)