Asp.net Jquery image delayed Loading

Source: Internet
Author: User

In e-commerce websites, the homepage loading speed is slow due to the large number of website image requests. The image loading mechanism allows users to access the page, only the images shown on the current screen are loaded to reduce the number of user requests and improve the user experience.

Procedure:

1. Introduce Jquery class library and delayed loading class library: http://files.cnblogs.com/ywqu/Jquery%E5%BB%B6%E8%BF%9F%E5%8A%A0%E8%BD%BD.rar

 

2. First add the original attribute to the image img and assign it to the image path.

3. Code on the page

<Script language = "javascript" type = "text/javascript">
$ (Function (){
$ ("Img [original]"). lazyload ({
Placeholder: "../Images/Default/grey.gif ",
Effect: "fadeIn"
});
});

</Script>

4. Final Results

 

 

 

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.