Last active
December 10, 2015 13:58
-
-
Save mcfdn/4443928 to your computer and use it in GitHub Desktop.
LiteMap example documentation 5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$map = new LiteMap_Container(); | |
$map->setCenter(51.500152, -0.126236); | |
$locations = array( | |
'51.500152' => '-0.126236', | |
'51.512249182894756' => '-0.15815299440919262', | |
'51.52325165255695' => '-0.11283439089356762', | |
'51.47238304492127' => '-0.15883963991700512', | |
'51.49077068938746' => '-0.07232230593263012' | |
); | |
foreach($locations as $lat => $lng) { | |
$marker = new LiteMap_Marker($lat, $lng); | |
$marker->setTitle('Latitude: ' . $lat . ', Longitude: ' . $lng); | |
$over = new LiteMap_Listener('mouseover'); | |
$over->addCustomJs('var el = document.getElementById("output"); el.innerHTML = "Mouse Over"'); | |
$marker->addListener($over); | |
$out = new LiteMap_Listener('mouseout'); | |
$out->addCustomJs('var el = document.getElementById("output"); el.innerHTML = "Mouse Out"'); | |
$marker->addListener($out); | |
$click = new LiteMap_Listener('click'); | |
$click->addCustomJs('alert("You just clicked :)")'); | |
$marker->addListener($click); | |
$map->addOverlay($marker); | |
} | |
?> | |
<div id="output">Output...</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment