Lazy load iframe video using IntersectionObserver Here is the below code that will load the iframe video when it iframe will be in the viewport.It is important that to fill the page i have used image tag with width and height.You can use your own data. <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> ...
Saturday, November 30, 2024
Auto execute code in javascript
How to write auto execute javascript code ?We can achieve it by 2 method.1- Standard auto execute function.2- Arrow function.Standard auto execute function. <script>(function() { const iamvar1= 'Iam var 1'; console.log('Auto Execute 1 function');})();</script>Arrow function.<script>(()=> { const iamvar2= 'Iam...
Passing value in Shopify snippets and use it
Passing value in Shopify snippets and use itYou are working on Shopify project with a snippet. In that snippet you want pass value as per your need. So how can you achieve it ?Let assume that you will use a snippet "rimg-a.liquid" in other liquid file and want to use as below. You want to pass imgurl, class and fetch value.================================================content...
Change video tag source url using javascript
Change video tag source url using JavascriptYou want change <video> tag's <source></source> src when click on button in HTML and Javascript.Here is the code with example<video autoplay="autoplay" control="false" id="howto" loop="loop" muted="muted" playsinline="playsinline" poster="POSTER IMAGE URL" preload="metadata"> ...