Giter Site home page Giter Site logo

magnusmartin85 / pure-js-lightbox Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 47.84 MB

Pure JS Lightbox is an open source project based on JavaScript. It's simple, mobile-friendly, has touch and swipe support and keyboard navigation. The project is licensed under the GPL-3.0 license.

Home Page: https://pure-js-lightbox.com

License: GNU General Public License v3.0

HTML 10.63% SCSS 22.51% TypeScript 66.86%
css javascript lightbox scss typescript webpack popup

pure-js-lightbox's Introduction

Pure JS Lightbox

Simple and lightweight JavaScript lightbox.

Features

  • Simple
  • Mobile friendly
  • Touch and swipe support
  • Keyboard navigation
  • Lightweight

Getting started

  1. Download the zip file of the latest release from GitHub. You will find HTML, JS and a CSS file inside.

  2. Include the CSS file at the top of your page in the head section: <link href="path/to/pure-js-lightbox-core.css" rel="stylesheet" />

  3. Place the script tag at the bottom of your page right before the closing body tag: <script src="path/to/pure-js-lightbox-core.js"></script>

  4. Add <img> tags with attributes to your html:

    <img
    class="preview-image"
    data-lightbox-id="nature"
    src="images/1.jpg"
    alt="Goettingen/Diemarden: Hay Bales After Mowing"
    data-photographer="© light.tales.photography by Micha Z."
    />
    
  5. Add markup for overlay:

     <div class="lightbox-overlay hidden"></div>
    
  6. Add markup for backdrop:

    <div class="lightbox-backdrop hidden"></div>
    
Attribute Required/Optional Description
class required Defaults to preview-image.
data-lightbox-id required Distinguish images between multiple image sets.
src required Relative image path. For example: images/3.jpg.
alt optional Text appears under the image.
data-photographer optional Source of the image. Appears under the image.

Local development

Installation

For installation cd into the project root and run npm install.

Development

To serve on localhost run npm run start on the command line.

Build

For a production build run npm run build on the command line. This will generate a public directory with index.html, pure-js-lightbox-core.js, pure-js-lightbox-core.css and loading-animation.svg.

Demo

Demo

Built with

TypeScript is JavaScript with syntax for types.

CSS with superpowers.

Module Bundler for JavaScript.

Demo images for the repository.

Beautiful demo images (on the demo web page).

Author

Magnus Martin

pure-js-lightbox's People

Contributors

magnusmartin85 avatar

Watchers

 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.