Add autoplay disableOnInteraction to Swiper options

This option is imperative. Pause on Hover is not enough. Not only is it annoying and an accessibility issue to have the slider advance automatically when not expected, but when an image is opened in the lightbox, the slider in the background either needs to be paused or stay in sync with the lightbox. Adding a Pause on Interaction option is the simplest solution.

Workaround:

/* Fix Swiper autoplay */
const swipers = document.querySelectorAll( '[data-script-args]' );
swipers.forEach( slider => {
	let args = slider.getAttribute( 'data-script-args' );
	args = args.replace( 'disableOnInteraction":false', 'disableOnInteraction":true' );
	slider.setAttribute( 'data-script-args', args );
} );
1 Like