Giter Site home page Giter Site logo

shuvojit33 / pilpil Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zafree/pilpil

0.0 1.0 0.0 14 KB

Pilpil - Progressive Image Loading

Home Page: https://zafree.github.io/pilpil

License: MIT License

CSS 24.15% JavaScript 59.93% HTML 15.92%

pilpil's Introduction

Pilpil - Progressive Image Loading

Pilpil is a tiny, pure JavaScript library for Progressive Image Loading with a blur effect to reduce the page load time; as seen on Medium.

Demo

https://zafree.github.io/pilpil

How

  1. Link files to your site or application (add <script> to bottom of page)
<link rel="stylesheet" href="css/pilpil.css">
<script src="js/pilpil.js"></script>
  1. Set markup
<div class="aspectRatioPlaceholder">
  <div class="aspectRatioPlaceholder-fill"></div>
  <div class="progressiveMedia" data-width="1920" data-height="1080">
    <img class="progressiveMedia-thumbnail" src="small-image-path" alt="" />
    <canvas class="progressiveMedia-canvas"></canvas>
    <img class="progressiveMedia-image" data-src="original-image-path" alt="" />
  </div>
</div>
  1. Add src small-image-path for class .progressiveMedia-thumbnail
<img class="progressiveMedia-thumbnail" src="small-image-path" alt="" />
  1. Set data-src="path" original-image-path for class .progressiveMedia-image
<img class="progressiveMedia-image" data-src="original-image-path" alt="" />
  1. And finally set original image size (width, height) that you used in data-src="path" to data-width and data-height for class .progressiveMedia. For example:
<div class="progressiveMedia" data-width="1920" data-height="1080">

Why

It's the best way to load an image. No dependencies. Pure JavaScript. Progressive Image Loading with a blur effect. Reduce the page loading time. Better user experience. Wow.

Where

Pilpil should (in theory) work in all relevant browsers (ie9+). If not, create an issue! Thanks!

Who

Written by Zafree, made better by you.

pilpil's People

Contributors

zafree avatar groe avatar dominionized avatar

Watchers

Shuvojit Das 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.