Skip to content

Instantly share code, notes, and snippets.

@mcfdn
Last active December 10, 2015 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcfdn/4443928 to your computer and use it in GitHub Desktop.
Save mcfdn/4443928 to your computer and use it in GitHub Desktop.
LiteMap example documentation 5
<?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