Git Product home page Git Product logo

microlite-pkg's Introduction

microlite package version

NPM

microlite is an über-small image lightbox that leaves a microscopic footprint. It was originally built by @danklammer. This repo (for packaging) will maintain feature parity with that original repo.

Table of Contents

Purpose

microlite is a JavaScript lightbox with zero dependencies. It has no extras, no icons, no options and no bloat, but looks nice and is easy to use. If you want special behavior, extra options or flexible features, you'll need to consider another lightbox library (or fork this one and edit it yourself!).

microlite only modifies and animates composite (transform and opacity) CSS properties, giving you buttery smooth 60 FPS transitions. And it uses CSS multiple backgrounds to load in the high-res version on top of the low-res, making the experience fast and seamless. Plus, including it in your app is as easy as importing and setting an onclick={}.

Installation

NPM:

npm install microlite --save

Other package managers:

Coming soon

Usage

React: Using microlite is easy: simply add the microlite function to the onclick event on an <a> tag, with the thumbnail inside it. Just make sure you pass it the event reference, like this:

/* Import microlite */
import microLite from 'microlite';

class YourLightboxImage extends React.Component {

  render() {
    return (
      <a href='[full-image.jpg]'  onClick={(e) => microLite(e)}>
        <img src='[thumbnail-image.jpg]' />
      </a>
    );
  }
}

...You can also use it without Babel/ES6 syntax, of course:

return (
  <a href='[full-image.jpg]'  onClick={function(e) { microLite(e) }}>
    <img src='[thumbnail-image.jpg]' />
  </a>
);

See this example for reference

Other platforms:

Coming soon

Features

  • Prevents wheel-scrolling
  • Closes on escape key keypress
  • Removes listeners when closed, keeping your window events clean

Demo

Try it out

MicroLite demo

microlite-pkg's People

Contributors

i-a-n avatar freelance-tech-writer avatar

Watchers

James Cloos 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.