Solerdev
Forum Replies Created
Viewing 2 replies - 1 through 2 (of 2 total)
-
the example link, I forgot to make it code mode:
<a class="moveGoogleMap" href="#-37.09024,-68.554687,4">chile</a>Hi,
Excellent plugin, thank you!
I’m looking for a method to change the location of the map by clicking links. I didn’t find a way to do it on a “onClick” event or from another JS code. Someone knows how to do that? something about namespace I think.After some tests, I made an alternative method that maybe can help someone:
Adding this code in cgmp.framework.js (or .min.js)
at the end of
if ($(‘div#’ + json.id).length > 0) {–>here
}else{
//Logger.fatal…
}the added code is:
$('.moveGoogleMap').click(function(e){ e.preventDefault(); newCoords = $(this).attr("href").split(" ").join("").split("#").join("").split(",") if(newCoords[0] != "" && newCoords[0] != undefined && newCoords[0] != null && newCoords[1] != "" && newCoords[1] != undefined && newCoords[1] != null){ googleMap.setCenter(new google.maps.LatLng( newCoords[0], newCoords[1] ) ); if(newCoords[2] != "" && newCoords[2] != undefined && newCoords[2] != null){ googleMap.setZoom(parseInt(newCoords[2])); } } })It adds the hability to any link with the class “moveGoogleMap” change the map by coords and zoom in the href attribute. The info is comma separated.
like this:hope it helps, Thanks again for the plugin!
Viewing 2 replies - 1 through 2 (of 2 total)