ebrelsford / Leaflet.loading

A simple loading control for Leaflet
MIT License
143 stars 49 forks source link

Get last button visible button instead zoomOut button #22

Closed dmolineus closed 9 years ago

dmolineus commented 9 years ago

When using other controls (e.g. a fullscreen control) which are rendered as part of the zoom control, toggling the leaflet-bar-part-bottom of the zoomOut button is not what's wanted.

This pull request uses the last visible button for toggle the state. Instead of getting the 2nd last button in the row, I've made and secure checking for the first visible one. Maybe overimplemented but who knows how it's used.

I don't have any experience of the zoomslider. So I've added it only to the standard zoom control.

ebrelsford commented 9 years ago

Good idea, thanks for the pr! Any chance you could provide an example to examples/ for ease of testing?

dmolineus commented 9 years ago

Example is added to the pr. I also add the leaflet-bar-part-bottom class to the last visible button then the element is created. Otherwise it is not rendered as expected.

ebrelsford commented 9 years ago

Thanks!