dimsemenov / PhotoSwipe

JavaScript image gallery for mobile and desktop, modular, framework independent
http://photoswipe.com
MIT License
24.22k stars 3.31k forks source link

V5 Beta Option arrowKeys: false, has no effect #1794

Open acwolff opened 3 years ago

acwolff commented 3 years ago

I used this code:

    import PhotoSwipeLightbox from './res/photoswipe-lightbox.esm.js'; 
    import PhotoSwipeDynamicCaption from './res/photoswipe-dynamic-caption-plugin.esm.js';
    const options = {
      arrowKeys: false,
      gallerySelector: '#gallery',

I did expect that the arrow buttons would disappear, but they are still visible.

Do I something wrongly or is this a bug?

Is there also an option to hide the toolbar with the buttons?

BTW this works:

    lightbox.on('afterInit', () => {
        document.querySelector('.pswp__top-bar').style.visibility = "hidden";
        document.querySelector('.pswp__button--arrow--next').style.visibility = "hidden";
        document.querySelector('.pswp__button--arrow--prev').style.visibility = "hidden";
    })
BilouMaster commented 3 years ago

arrowKeys is an option to enable or disable keyboard navigation.

To remove the arrow buttons, try:

arrowPrev: false,
arrowNext: false

It works for removing the zoom and close buttons too, just set zoom and/or close to false. You can also set counter to false

If it doesn't work, try:

arrowPrevSVG: '',
arrowNextSVG: ''
acwolff commented 3 years ago

To remove the arrow buttons, try:

arrowPrev: false,
arrowNext: false

Yes, that works too, but in that case I can't use next code to solve the right arrow problem:

lightbox.on('change', () => {
    document.querySelector('.pswp__button--arrow--next').style.zIndex = "9999";
});

So I will use the method I did give above.

BilouMaster commented 3 years ago

To remove the arrow buttons, try:

arrowPrev: false,
arrowNext: false

Yes, that works too, but in that case I can't use next code to solve the right arrow problem

If you don't want to show the arrows... There is no more issue to solve with superposition and you don't need that code anymore, right? ... 🤔

acwolff commented 3 years ago

Correct, but some of my users like to hide these buttons on mobile devices, but not on PC's, so in that case I have still to solve the issue.

BilouMaster commented 3 years ago

Yup, but we still can hide the ui elements with a single tap on screen. :) I like that feature

acwolff commented 3 years ago

Aha, I did not know that.

Thanks for this tip!