M
M
Maxim2014-04-23 16:15:45
JavaScript
Maxim, 2014-04-23 16:15:45

How to catch click event on google map?

The jquery.ui.map plugin is used, there are no examples in the documentation for working with 'click' 'dubble click', and others.
Tell me how to correctly catch the 'click' event on the google map using this plugin?
I create a map like this

$(document).ready(function() {
    $('#map_canvas').gmap({ 'center': '42.345573,-71.098326',scrollwheel: true, 'callback':load_points()});
})

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
pingo, 2014-04-23
@iru

probably need to pick up the "service" additional
and then hang the event handler:

$('#map_canvas').gmap().bind('init', function(event, map) { 
    $(map).click( function(event) {
        $('#map_canvas').gmap('addMarker', {
            'position': event.latLng, 
            'draggable': true, 
            'bounds': false
        }, function(map, marker) {
                        marker.__gm_id
        });
    });
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question