dimsemenov / Magnific-Popup

Light and responsive lightbox script with focus on performance.
http://dimsemenov.com/plugins/magnific-popup/
MIT License
11.39k stars 3.48k forks source link

Automatic RTL support and gallery non-loop option #1175

Closed joloco closed 3 years ago

joloco commented 3 years ago

I'm developing a site in a right-to-left language (the main two are Arabic and Hebrew) and therefore the gallery next/prev buttons are the wrong way around -- for them, the left button should be "next" and the right button should be "prev".

The direction is discerned by checking document.dir and switching to RTL if the value there is "rtl" -- otherwise, the normal LTR behaviour is used.

The direction can be set explicitly using the "langDir" option when initialising the gallery.

joloco commented 3 years ago

Tackles issue #1058 (though it doesn't change the location of the close button, as also requested in that issue)

joloco commented 3 years ago

I've also added optional looping of gallery popups. Set "loop: false" in the gallery setup object, and the first won't show a 'previous' button, and the last won't let you go to the 'next' one.

Also, added references to 'arrowPrev' and 'arrowNext' (as counterparts to the already-existing 'arrowLeft' and 'arrowRight') to help programmers target the buttons based on their action, rather than their position on the screen.

dimsemenov commented 3 years ago

That's very nice, thank you. I'll review and merge if all good.

joloco commented 2 years ago

That's great, thank you!