GithubHelp home page GithubHelp logo

lazy's Introduction

lazy.js

用于移动端滚动按需,包括图片按需加载和js按需执行

  • jsList {Array} js按需执行列表项
    • id {String} 滚动到当前id执行对应js项
    • js {Function | String} 按需执行的js
  • target {String | Array} 按需加载图片的容器id
  • imgSrc {String} 图片真实地址属性
  • offset {Number} 灵敏度 如设置为100 表示滚动在距离目标位置100px执行,默认为半屏高度
  • delay {Number} 滚动触发加载的延时,用于滚动节流,默认值是 100,单位毫秒
  • delay_ot {Number} 滚动过程中多长时间后强行触发一次,默认值是 1000,单位毫秒
  • imgLoad {Function} 真实图片加载完后执行。传回三个参数:1、element{DOM} 目标图片 2、width {Number} 真实图片实际宽度 3、height {Number}真实图片实际高度
var jsList_ = [{
    id: 'test1',
    js: function() {}
}, {
    id: 'test2',
    js: 'alert("test2")'
}];

var xx = Lazy.create({
    jsList: jsList_,
    target: 'JimgLoad',
    imgSrc: 'lazy-src',
    offset: 100,
    delay: 100,
    delay_ot: 1000,
    imgLoad: function(element, width, height) {}
})
Lazy.init(xx)

lazy's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.