Fix Slick Slider – Does not use passive listeners to improve scrolling performance

Fix Slick Slider Google Pagespeed Insight “Does not use passive listeners to improve scrolling performance”. Slick slider yang digunakan pada plugin Gutenslider.

Letakkan kode berikut pada akhir halaman sebelum </body>

<script>
jQuery.event.special.touchstart = { setup: function (_, ns, handle) { if (ns.includes('noPreventDefault')) { this.addEventListener('touchstart', handle, { passive: false }); } else { this.addEventListener('touchstart', handle, { passive: true }); } } };

jQuery.event.special.touchmove = { setup: function (_, ns, handle) { if (ns.includes('noPreventDefault')) { this.addEventListener('touchmove', handle, { passive: false }); } else { this.addEventListener('touchmove', handle, { passive: true }); } } };
</script>

Credit: Quazz

Tinggalkan Balasan

Alamat email Anda tidak akan dipublikasikan. Ruas yang wajib ditandai *