0

I just want to make onclick event in zoom in and zoom out. How can I do it? I just confused to make it because zoom in and zoom out is something that generated by library.

Should I make new function? How I make it possible?

1

Assuming your map variable is called map, this zooms in when you click the map:

map.on('click', function() {

   map.zoomIn();

});

If you're asking to fire an event when zooming happens, then use:

map.on('zoom', function() {

   alert('Zoom, zoom, zoom, zoom, I want you in my room');

});

You can also use the zoomend or zoomend events.

  • Amazing alert!!haha – Fran Raga Sep 26 at 19:48
  • thank you!! it works – Ray Coder Oct 1 at 16:58
0

Use map events. zoomstart,zoom,zoomend can be used. e.g.

map.on({zoom : yourfunction})
  • thank you it works!! – Ray Coder Oct 1 at 16:58

Not the answer you're looking for? Browse other questions tagged or ask your own question.