Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hello,
I'm trying to add the passive flag that is missing according to GTMetrix. The inspector tells me line 897, and am viewing it in the Sources tab, but I'm not sure exactly how to implement it.
I tried adding it to my theme.js, but nothing seems to be working here either. My site is https://www.killyourgod.ai
The line specified by Lighthouse is:
<body class="template-index" ontouchstart="return true;" data-transitions="true" data-animate_underlines="true" data-animate_images="true" data-button_style="shadow" data-type_product_capitalize="true" data-type_header_capitalize="true" data-product_image_scatter="false" data-button_type_style="caps">
The code that I assume I would edit in the theme.js is:
// Prevent vertical scroll while using flickity sliders
(function() {
var e = !1;
var t;
document.body.addEventListener('touchstart', function(i) {
if (!i.target.closest('.flickity-slider')) {
return e = !1;
void 0;
}
e = !0;
t = {
x: i.touches[0].pageX,
y: i.touches[0].pageY
}
})
document.body.addEventListener('touchmove', function(i) {
if (e && i.cancelable) {
var n = {
x: i.touches[0].pageX - t.x,
y: i.touches[0].pageY - t.y
};
Math.abs(n.x) > Flickity.defaults.dragThreshold && i.preventDefault()
}
}, { passive: !1 })
})();
Can anyone assist?
I still need assistance with this, if anyone can help. Thank you.
By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024Thanks to everyone who participated in our AMA with 2H Media: Marketing Your Shopify St...
By Jacqui Sep 6, 2024