Code Monkey home page Code Monkey logo

lz.js's Introduction

lz.js

html 使用 Jquery 懒加载 与 webp 整合优化

使用方法

引入jquery.lazyload.lz.js

例如:

<img src="occupying270.png" data-original="4304485231505859.jpg" webp="true">

img标签增加webp 属性 控制是否使用webp模式

webp="true" ,该img路径使用webp格式模式,判断客户端是否兼容webp格式如果客户端兼容webp格式,该img路径使用data-original替换.jpg或.jpeg 为.webp路径,如果不兼容使用data-original设置的路径。

webp="false" 或 webp属性未设置,该img路径使用data-original设置的路径。

图片懒加载使用方式参考jquery懒加载事例

$("img").lazyload({   
	threshold : 200,  
    effect: "fadeIn"  
});

lz.js's People

Contributors

wugemu avatar

Stargazers

万大饼(Carol) avatar TaurusXi avatar Ji.K avatar

Watchers

James Cloos avatar  avatar

Forkers

cced3000

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.