");
return iw;
}
//创建一个Icon
function createIcon(json) {
var icon = new BMap.Icon("/public/images/contcat/mapicon.png", new BMap.Size(104, 119), { imageOffset: new BMap.Size(-json.l, -json.t), infoWindowOffset: new BMap.Size(json.lb + 5, 1), offset: new BMap.Size(json.x, json.h) })
return icon;
}
initMap();//创建和初始化地图
}
aa();
bb();
var tabs = function () {
function tag(name, elem) {
return (elem || document).getElementsByClassName(name);
}
//获得相应ID的元素
function id(name) {
return document.getElementById(name);
}
function first(elem) {
elem = elem.firstChild;
return elem && elem.nodeType == 1 ? elem : next(elem);
}
function next(elem) {
do {
elem = elem.nextSibling;
} while (
elem && elem.nodeType != 1
)
return elem;
}
return {
set: function (elemId, tabId) {
var elem = tag("maptitle", id(elemId));
var tabs = tag("tab-pane1", id(tabId));
var listNum = elem.length;
var tabNum = tabs.length;
console.log(listNum, tabNum)
console.log(elem, tabs)
for (var i = 0; i < listNum; i++) {
elem[i].onclick = (function (i) {
return function () {
for (var j = 0; j < tabNum; j++) {
if (i == j) {
tabs[j].style.display = "block";
$(this).addClass("active").siblings().removeClass("active");
aa();
}
else {
tabs[j].style.display = "none";
}
}
}
})(i)
}
}
}
}();
tabs.set("newtab", "tab-content");//执行