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?

2

2 Answers 2

5

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.

3
0

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

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

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