@@ -71,6 +71,7 @@ module.exports = async (page, scenario, config) => {
7171 iframe . loading = 'eager' ;
7272 } ) ;
7373
74+ // Avoid Slick carousel autoplay.
7475 if ( typeof $ == 'undefined' && typeof jQuery == 'function' ) {
7576 window . $ = jQuery ;
7677 }
@@ -93,6 +94,7 @@ module.exports = async (page, scenario, config) => {
9394 $ ( carousel ) . slick ( 'slickGoTo' , 0 , true ) ;
9495 }
9596 } ) ;
97+ // Improve text rendering for Slick carousels.
9698 if ( slickCarousels . length > 0 ) {
9799 const head = document . head || document . getElementsByTagName ( 'head' ) [ 0 ] ;
98100 const style = document . createElement ( 'style' ) ;
@@ -103,6 +105,15 @@ module.exports = async (page, scenario, config) => {
103105 style . appendChild ( document . createTextNode ( css ) ) ;
104106 }
105107
108+ // Avoid Swiper autoplay.
109+ const swiperCarousels = document . querySelectorAll ( '.swiper-initialized' ) ;
110+ swiperCarousels . forEach ( ( carousel ) => {
111+ if ( carousel . swiper ) {
112+ carousel . swiper . autoplay . stop ( ) ;
113+ carousel . swiper . slideTo ( 0 , 0 ) ;
114+ }
115+ } ) ;
116+
106117 // Force oembed-lazyload videos to not load when using intersection observer strategy.
107118 const oembedLazyVideos = document . querySelectorAll ( '.oembed-lazyload[data-strategy= "intersection-observer"]' ) ;
108119 oembedLazyVideos . forEach ( ( video ) => {
0 commit comments