Recently used js plug-ins: TouchSlide. js, LazyLoad. js,

Source: Internet
Author: User

Recently used js plug-ins: TouchSlide. js, LazyLoad. js,

Recently used several useful js plug-ins, one is lazyLoad. js for delayed loading, and the other is TouchSlide. js that provides the scrolling playback effect.

Attached usage Portal:

LazyLoad (loading only images within the field of view): http://www.cnblogs.com/ahjesus/archive/2010/10/09/1998642.html

TouchSlide (mobile version, independent of other js libraries): http://www.superslide2.com/TouchSlide/howToUse.html


How to Use JqueryLazyLoadjs,

Here is a link for Jquery. LazyLoad usage.
Www.neoease.com/..image/

How to Implement lazyload in JS

$. Belowthefold = function (element, settings) {if (settings. container === undefined | settings. container = window) {var fold = $ (window ). height () + $ (window ). scrollTop ()} else {var fold = $ (settings. container ). offset (). top + $ (settings. container ). height ()} return fold <= $ (element ). offset (). top-settings. threshold}; $. rightoffold = function (element, settings) {if (settings. container === undefined | settings. container = window) {var fold = $ (window ). width () + $ (window ). scrollLeft ()} else {var fold = $ (settings. container ). offset (). left + $ (settings. container ). width ()} return fold <= $ (element ). offset (). left-settings. threshold}; this is from lazyload. the two pieces of code extracted in js first judge scrolltop + body. whether the offsetHeight parameter is set. When determining the left margin of the screen and adding the width of the slice, there is a display: none parameter to determine whether it is useful to you.
In this way, images that are not on the screen are not loaded and need to be called again to load the images,


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.