开发者

avoid loading images using javascript

开发者 https://www.devze.com 2023-01-09 09:53 出处:网络
Say I have the followi开发者_如何学JAVAng code in my html: <html> <....> <img src=\"the-image.gif\" />

Say I have the followi开发者_如何学JAVAng code in my html:

<html>
  <....> 
   <img src="the-image.gif" />
  <....>
</html>

Is it possible to avoid loading the image using javascript? I want to load it later, using javascript. But I don't want it to be loaded automatically.

I am trying to delay the request of the image.

Thanks


You can use the LazyLoad jQuery Plugin.

Lazy loader is a jQuery plugin written in JavaScript. It delays loading of images in (long) web pages. Images outside of viewport (visible part of web page) wont be loaded before user scrolls to them. This is opposite of image preloading.

0

精彩评论

暂无评论...
验证码 换一张
取 消