" : "") + provinces[i].officeaddress + ""); } MapClick.find("li").eq(0).addClass("active"); var map = new AMap.Map('container', { resizeEnable: true, zoom: 15, center: provinces[0].officesxy.split(',') }); for (var i = 0, marker; i < provinces.length; i++) { var marker = new AMap.Marker({ position: provinces[i].officesxy.split(','), map: map }); } marker.setMap(map); $(".map-click").on("click", "li", function () {//點擊切換 $(this).addClass("active").siblings("li").removeClass("active"); var ThisObj = provinces[$(this).index()]; infowindow.setContent('
' + ThisObj.officename + '
' + (ThisObj.officecontactor != "" ? "聯系人:"+ThisObj.officecontactor + "
" : "") + (ThisObj.officecontactortel != "" ? "聯系電話:"+ThisObj.officecontactortel + "
" : "") + (ThisObj.officeemail != "" ? "聯系郵箱:"+ThisObj.officeemail + "
" : "") + (ThisObj.officetelephone != "" ? "電話:"+ThisObj.officetelephone + "
" : "") + (ThisObj.officehotline != "" ? "做事熱線:"+ThisObj.officehotline + "
" : "") + (ThisObj.officefax != "" ? "傳真:"+ThisObj.officefax + "
" : "") + (ThisObj.officeaddress != "" ? "地址:"+ThisObj.officeaddress + "
" : "") + (ThisObj.officezipcode != "" ? "郵編:"+ThisObj.officezipcode + "
" : "") + '
'); infowindow.open(map, ThisObj.officesxy.split(',')); map.setZoom(15); map.panTo(ThisObj.officesxy.split(',')); }) AMap.plugin('AMap.AdvancedInfoWindow', function () {//默許济南圣豪士国贸有限公司顯示 infowindow = new AMap.AdvancedInfoWindow({ content: '' + provinces[0].officename + '
' + (provinces[0].officecontactor != "" ? "聯系人:"+provinces[0].officecontactor + "
" : "") + (provinces[0].officecontactortel != "" ? "聯系電話:"+provinces[0].officecontactortel + "
" : "") + (provinces[0].officeemail != "" ? "聯系郵箱:"+provinces[0].officeemail + "
" : "") + (provinces[0].officetelephone != "" ? "電話:"+provinces[0].officetelephone + "
" : "") + (provinces[0].officehotline != "" ? "做事熱線:"+provinces[0].officehotline + "
" : "") + (provinces[0].officefax != "" ? "傳真:"+provinces[0].officefax + "
" : "") + (provinces[0].officeaddress != "" ? "地址:"+provinces[0].officeaddress + "
" : "") + (provinces[0].officezipcode != "" ? "郵編:"+provinces[0].officezipcode + "
" : "") + '
', offset: new AMap.Pixel(0, -30) }); infowindow.open(map, provinces[0].officesxy.split(',')); }) AMap.plugin(['AMap.ToolBar', 'AMap.Scale', 'AMap.OverView'], function () { map.addControl(new AMap.ToolBar()); map.addControl(new AMap.Scale()); map.addControl(new AMap.OverView({ isOpen: true })); });