Мне нужно центрировать карту и открыть всплывающее окно информации по внешней ссылке на карту. Ссылка может быть даже onclick = "javascript ();" применяется к якору.
Код моей карты:
$('#wtb-map').gmap3(
{ action:'init',
options:{
streetViewControl: false,
mapTypeControl: false
//zoom: 5
}
},
{ action: 'addMarkers',
markers:[
{lat:49.8620722, lng:6.352047, data:'<div class="infowindow"><p><strong>cccc</strong><br/> 275 Croydon Road, Beckenham<br/>Kent, BR3 3PS<br/>United Kingdom <br/>0208-6501300 <br/> <a href="">www.mywebsite.co.uk</a><br/><strong class="tipo">RESELLER</strong></p><a class="moreinfo" href="wtb-about.php">more info</a></div>'},
{lat:46.59433,lng:0.342236, data:'<div class="infowindow"><p><strong>aaaaa</strong><br/> 275 Croydon Road, Beckenham<br/>Kent, BR3 3PS<br/>United Kingdom <br/>0208-6501300 <br/> <a href="">www.mywebsite.co.uk</a><br/><strong class="tipo">RESELLER</strong></p><a class="moreinfo" href="wtb-about.php">more info</a></div>'},
{lat:42.704931, lng:2.894697, data:'<div class="infowindow"><p><strong>bbbbb</strong><br/> 275 Croydon Road, Beckenham<br/>Kent, BR3 3PS<br/>United Kingdom <br/>0208-6501300 <br/> <a href="">www.mywebsite.co.uk</a><br/><strong class="tipo">RESELLER</strong></p><a class="moreinfo" href="wtb-about.php">more info</a></div>'}
],
marker:{
options:{
draggable: false,
icon:"../img/marker.png"
},
events:{
click: function(marker, event, data){
var map = $(this).gmap3('get'),
infowindow = $(this).gmap3({action:'get', name:'infowindow'});
if (infowindow){
infowindow.open(map, marker);
infowindow.setContent(data);
} else {
$(this).gmap3({action:'addinfowindow', anchor:marker, options:{content: data}});
}
}
}
}
},
"autofit");
так
<a href="#" onclick="code to center/open info map to the first marker">One</a>
<a href="#" onclick="code to center/open info map to the secondmarker">Two</a>
<a href="#" onclick="code to center/open info map to the thirdmarker">3</a>
Любые предложения приветствуются.