Javascript - Detect Mobile width, Add lazy loading attr to a set of images

//Lazy Load Sidebar images on mobile
if(window.innerWidth <650){
console.log("mobile!");
const collection = document.querySelectorAll("#FeaturedProductsCombined img");
for (let i = 0; i < collection.length; i++) {
collection[i].setAttribute("loading", "lazy");
}

}

More From This Section

e.g intro to pagebanner
Disable right-click on the site which should disable the context menu on click on android.
Replace Name with First Name and Last Name fields, but keep name field for submission. Merge First/Last to Name on change

FAQ Topics

Search for help:

> Home