Hi~

I've created map with {draggable:false} option and positioned a marker
over it.
when I clicked marker which is draggable or not, map also fires "map
click" events.
Actually I should use map click event for different use,
so, how can I distinguish click marker only? (without firing map click
event)

Here goes sample codes:


<html>
<head>
        <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /
>
        <script type="text/javascript" src="http://maps.google.com/maps/api/
js?sensor=false"></script>
        <script type="text/javascript">
        function initialize() {
                var latlng = new google.maps.LatLng(-34.397, 150.644);
                var latlng2 = new google.maps.LatLng(-33.397, 151.644);
                var map = new 
google.maps.Map(document.getElementById("map_canvas"),
{
                        zoom: 8,
                        center: latlng,
                        mapTypeId: google.maps.MapTypeId.ROADMAP,
                        draggable: false,
                });

                google.maps.event.addListener(map, 'click', function() {
                        console.log('map clicked');
                });

                var fixed_marker = new google.maps.Marker({
                        map: map,
                        position: latlng,
                        clickable: true,
                        draggable: false,
                });

                google.maps.event.addListener(fixed_marker,'click',function(){
                        console.log('fixed marker clicked');
                });

                var draggable_marker = new google.maps.Marker({
                        map: map,
                        position: latlng2,
                        clickable: true,
                        draggable: true,
                });

                
google.maps.event.addListener(draggable_marker,'click',function(){
                        console.log('draggable marker clicked');
                });
        }

        </script>
</head>
<body onload="initialize()">
        <div id="map_canvas" style="width:100%; height:100%"></div>
</body>
</html>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to