It is like knowing how this gentle appearance of images works.

Source: Internet
Author: User
I like to know how the smooth appearance of images is implemented? In addition, the direct display of high efficiency is still highly efficient in this way. it is like knowing how this gentle image effect works.
Http://down.chinaz.com/class/55_1.htm
The image shown on the above website is only loaded when it appears. The effect is smooth transition.

How to implement it?

In addition, the efficiency of direct display is still high.

------ Solution --------------------
This is the effect of delayed loading of images, avoiding slow page loading due to excessive http connection requests during initial page loading.


Search for lazyload
------ Solution --------------------
The imgtag is a gray image of grep.jpg, a negative image. since the URL is used to access the page at the beginning, it saves traffic when the image is downloaded and cached.

Others are triggered by scroll events. The author adds an original attribute to the tag to record the actual image URL. when the image is rolled to the field of view, the original is set to src, so I began to download the image.

The landlord can take the code directly and check whether it is written by jq. There are many js code on the Internet, which is not complicated. It just traverses the labels of a class every time to see if they are on the screen. just change src.

Http://down.chinaz.com/js/imgload.js this site's lazyload JS
------ Solution --------------------
It looks amazing, but it seems that I don't know how to apply it. JS is downloaded, which is terrible! Alas... I hope you can describe it in detail upstairs.

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.