CoString of GMap Accessing arguments in UI events
View this example in sandbox :
o,24.88065,121.065427&z,12
View this example full screen.
View this example in sandbox :
o,24.88065,121.065427&z,12
function initialize() { var oMapOptions = { coStrType: zhupiter.CoStr.CoStrType.GMAP, center: new google.maps.LatLng(24.880650, 121.065427), zoom: 12 }; var oCoStrMap = new zhupiter.CoStr.Map(document.getElementById('map_canvas'), oMapOptions); zhupiter.CoStr.event.addListener(oCoStrMap, 'click', function(oInEv) { addMarker(oCoStrMap, oInEv.latLng); }); } function addMarker(oInMap, oInPos) { var oMarker = new zhupiter.CoStr.Marker({ coStrMap: oInMap, position: oInPos }); } zhupiter.CoStr.event.addDomListener(window, 'load', initialize);
<!DOCTYPE html> <html> <head> <meta name='viewport' content='initial-scale=1.0, user-scalable=no'> <meta charset='utf-8'> <title>GMap Accessing arguments in UI events</title> <style> html, body, #map_canvas { height: 100%; margin: 0px; padding: 0px } </style> <script src='https://maps.googleapis.com/maps/api/js'></script> <script src='//costr.zhupiter.com/js/'></script> <script> function initialize() { var oMapOptions = { coStrType: zhupiter.CoStr.CoStrType.GMAP, center: new google.maps.LatLng(24.880650, 121.065427), zoom: 12 }; var oCoStrMap = new zhupiter.CoStr.Map(document.getElementById('map_canvas'), oMapOptions); zhupiter.CoStr.event.addListener(oCoStrMap, 'click', function(oInEv) { addMarker(oCoStrMap, oInEv.latLng); }); } function addMarker(oInMap, oInPos) { var oMarker = new zhupiter.CoStr.Marker({ coStrMap: oInMap, position: oInPos }); } zhupiter.CoStr.event.addDomListener(window, 'load', initialize); </script> </head> <body> <div id='map_canvas'></div> </body> </html>
CoString | Donate bitcoin: 1LX5KC19tXCPK8y72Z6LVoZjoSaCp9P6K