Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lazyimg

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lazyimg

图片懒加载

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

新版 lib-img 库,开源版

依赖

  1. appear

特性

抽象出懒加载部分作为 lib-appear 库, 可实现其他类似懒加载的功能

APIS

lib.img.fire()

重新遍历懒加载图片,绑定懒加载, 处理 CDN 后缀. 此方法可以被多次调用,对同一个元素不会处理多次

lib.img.logConfig()

在 console 中打出当前的配置, 供 debug 使用

使用范例

    <style>
        .my-img {
            display: block;
            margin-bottom: 10px;
            width: 5.33rem;
            height: 4rem;
        }

    </style>
    
    <img class="my-img" img-src="http://gw.alicdn.com/tfscom/TB1hScdIFXXXXX7aXXXlQjeFXXX-1024-769.jpg">    
    <img class="my-img" img-src="http://gw.alicdn.com/tfscom/TB1hScdIFXXXXX7aXXXlQjeFXXX-1024-769.jpg">
    <img class="my-img" img-src="http://gw.alicdn.com/tfscom/TB1hScdIFXXXXX7aXXXlQjeFXXX-1024-769.jpg">
    <img class="my-img" img-src="http://gw.alicdn.com/tfscom/TB1hScdIFXXXXX7aXXXlQjeFXXX-1024-769.jpg">
    <img class="my-img" img-src="http://gw.alicdn.com/tfscom/TB1hScdIFXXXXX7aXXXlQjeFXXX-1024-769.jpg">
    <img class="my-img" img-src="http://gw.alicdn.com/tfscom/TB1hScdIFXXXXX7aXXXlQjeFXXX-1024-769.jpg">
    <img class="my-img" img-src="http://gw.alicdn.com/tfscom/TB1hScdIFXXXXX7aXXXlQjeFXXX-1024-769.jpg">
    <img class="my-img" img-src="http://gw.alicdn.com/tfscom/TB1hScdIFXXXXX7aXXXlQjeFXXX-1024-769.jpg">
    <img class="my-img" img-src="http://gw.alicdn.com/tfscom/TB1hScdIFXXXXX7aXXXlQjeFXXX-1024-769.jpg">
        
    <script>
        lib.img.fire();
    </script>
    

更新记录

FAQs

Package last updated on 20 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc