About picture deferred loading solutions (for mobile)

Source: Internet
Author: User

In the case of more pages, in order to optimize performance, you can use lazy loading technology, I encapsulated a lightweight plug-in.

Plug - ins:

Http://pan.baidu.com/s/1o6804Gy

How to use:

1 need to introduce ECHO.CSS and echo.min.js in the page

2 for images that require lazy loading, use the following notation:

Blank.gif is a background image that is included in the plugin. The width of the picture must be set, of course, you can use an external style to control the size of multiple images.

The Data-echo points to the real picture address.

3 initialization of the plug-in:

Echo.init ();
as simple as this, you will be able to see that the image is loaded only when it appears in the field of view, reducing the rendering effort of the page.


Description

We know that the jquery lazyloading plugin has been able to do this well, but it is based on jquery and may not be practical for mobile, and this plugin does not rely on any third-party libraries, and the core files are only about 3KB, which is ideal for mobile development.

Solutions for picture lazy loading (for mobile)

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.