PhotoSwipe icon indicating copy to clipboard operation
PhotoSwipe copied to clipboard

V5 Beta Option arrowKeys: false, has no effect

Open acwolff opened this issue 4 years ago • 6 comments

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";
    })

acwolff avatar Jul 28 '21 14:07 acwolff

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: ''

BilouMaster avatar Jul 28 '21 15:07 BilouMaster

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.

acwolff avatar Jul 28 '21 15:07 acwolff

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? ... 🤔

BilouMaster avatar Jul 28 '21 16:07 BilouMaster

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.

acwolff avatar Jul 28 '21 16:07 acwolff

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

BilouMaster avatar Jul 28 '21 16:07 BilouMaster

Aha, I did not know that.

Thanks for this tip!

acwolff avatar Jul 28 '21 20:07 acwolff