jquery - Is there any way to prevent page load of images with javascript? -


I want to create a lazy loading plugin. Some resources have indicated that as soon as the source is defined on an image, the browser starts loading it. At which point in the page processing does this happen? Is it possible in some JavaScript that this code prevents it from happening?

If I have correctly understood that you do not load an image unless that Do not interact in a user somehow, this is what you are looking for.

JSField:

  & lt; Img id = "myImg" src = "" width = "107" height = "98" & gt; & Lt; Button onclick = "myfunction ()" & gt; Load image & lt; / Button & gt; & Lt; Script & gt; Function myFunction () {document.getElementById ("myImg"). Src = "http://www.w3schools.com/jsref/compman.gif"; } & Lt; / Script & gt;   

If this has helped, accept the answer.

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -