• Stars
    star
    6,371
  • Rank 6,250 (Top 0.2 %)
  • Language
    TypeScript
  • License
    Other
  • Created over 10 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A customizable, modular, responsive, lightbox gallery plugin.

commit npm npm-tag size tree-shaking types hits

lightGallery

A customizable, modular, responsive, lightbox gallery plugin. No dependencies.\ Available for React.js, Angular, Vue.js, and typescript.

lightgallery

Core features

  • Fully responsive.
  • Modular architecture with built in plugins.
  • Highly optimized for touch devices.
  • Mouse drag supports for desktops.
  • Double-click/Double-tap to see actual size of the image.
  • Animated thumbnails.
  • Social sharing.
  • YouTube Vimeo Wistia and html5 videos Support.
  • 20+ Hardware-Accelerated CSS3 transitions.
  • Dynamic mode.
  • Inline gallery.
  • Full screen support.
  • Zoom in/out, Pinch to zoom.
  • Swipe/Drag up/down support to close gallery.
  • Browser history API(deep linking).
  • Responsive images.
  • HTML iframe support.
  • Multiple instances on one page.
  • Easily customizable via CSS (SCSS) and Settings.
  • Smart image preloading and code optimization.
  • Keyboard Navigation for desktop.
  • SVG icons.
  • Accessibility support.
  • Rotate, flip images.
  • And many more.

Documentation

Installation

lightGallery is available on NPM, Yarn, Bower, CDNs, and GitHub. You can use any of the following method to download lightGallery.

  • NPM - NPM is a package manager for the JavaScript programming language. You can install lightgallery using the following command

    npm install lightgallery
  • YARN - Yarn is another popular package manager for the JavaScript programming language. If you prefer you can use Yarn instead of NPM

    yarn add lightgallery
  • Bower - You can find lightGallery on Bower package manager as well

    bower install lightgallery --save
  • GitHub - You can also directly download lightgallery from GitHub

  • CDN - If you prefer to use a CDN, you can load files via jsdelivr, cdnjs or unpkg

Include CSS and Javascript files

First of all, include lightgallery.css in the <head> of the document. If you want include any lightGallery plugin such as thumbnails or zoom, you need to include respective css files as well.

Alternatively you can include lightgallery-bundle.css which contains lightGallery and all plugin styles instead of separate stylesheets.

If you like you can also import scss files instead of css files from the scss folder.

<head>
    <link type="text/css" rel="stylesheet" href="css/lightgallery.css" />

    <!-- lightgallery plugins -->
    <link type="text/css" rel="stylesheet" href="css/lg-zoom.css" />
    <link type="text/css" rel="stylesheet" href="css/lg-thumbnail.css" />


    <!-- OR -->

    <link type="text/css" rel="stylesheet" href="css/lightgallery-bundle.css" />
</head>

Then include lightgallery.umd.js into your document. If you want to include any lightgallery plugin you can include it after lightgallery.umd.js.

<body>
    ....

    <script src="js/lightgallery.umd.js"></script>

    <!-- lightgallery plugins -->
    <script src="js/plugins/lg-thumbnail.umd.js"></script>
    <script src="js/plugins/lg-zoom.umd.js"></script>
</body>

lightGallery supports AMD, CommonJS and ES6 modules too.

import lightGallery from 'lightgallery';

// Plugins
import lgThumbnail from 'lightgallery/plugins/thumbnail'
import lgZoom from 'lightgallery/plugins/zoom'

The markup

lightgallery does not force you to use any kind of markup. you can use whatever markup you want. Here can find detailed examples of different kinds of markups.

If you know the original size of the media, you can pass it via data-lg-size="${width}-${height}" attribute for the initial zoom animation. But, this is completely optional.

<div id="lightgallery">
    <a href="img/img1.jpg" data-lg-size="1600-2400">
        <img alt=".." src="img/thumb1.jpg" />
    </a>
    <a href="img/img2.jpg" data-lg-size="1024-800">
        <img alt=".." src="img/thumb2.jpg" />
    </a>
    ...
</div>

Initialize lightGallery

Finally, you need to initiate the gallery by adding the following code.

<script type="text/javascript">
    lightGallery(document.getElementById('lightgallery'), {
        plugins: [lgZoom, lgThumbnail],
        speed: 500,
        licenseKey: 'your_license_key'
        ... other settings
    });
</script>

CodePen Demos

License Key

You'll receive a license key via email one you purchase a license More info

Plugins

As shown above, you need to pass the plugins via settings if you want to use any lightGallery plugins.

If you are including lightGallery files via script tag, please use the same plugins names as follows.

lgZoom, lgAutoplay, lgComment, lgFullscreen , lgHash, lgPager, lgRotate, lgShare, lgThumbnail, lgVideo, lgMediumZoom

Browser support

lightGallery supports all major browsers including IE 10 and above.

License

Commercial license

If you want to use lightGallery to develop commercial sites, themes, projects, and applications, the Commercial license is the appropriate license. With this option, your source code is kept proprietary. Read more about the commercial license

Open source license

If you are creating an open source application under a license compatible with the GNU GPL license v3, you may use this project under the terms of the GPLv3.

Support

If you have any questions, suggestions, feedback, please reach out to [email protected] or DM me on twitter

More Repositories

1

lightgallery.js

Full featured JavaScript image & video gallery. No dependencies
JavaScript
5,270
star
2

lightslider

JQuery lightSlider is a lightweight responsive Content slider with carousel thumbnails navigation
JavaScript
2,044
star
3

replace-jquery

Automatically finds jQuery methods from existing projects and generates vanilla js alternatives.
JavaScript
1,152
star
4

lightgallery-desktop

A modern, electron and nodejs based image viewer for Mac, Windows and Linux.
JavaScript
993
star
5

ngclipboard

An angularjs directive to copy text to clipboard without using flash
JavaScript
387
star
6

angular-trix

A rich WYSIWYG text editor directive for angularjs.
JavaScript
330
star
7

angular-flash

A simple lightweight flash message module for angularjs
JavaScript
261
star
8

ladda-angular

Ladda button directive for angularjs
JavaScript
125
star
9

tiny-events.js

TinyEvents is a tiny event utility library for modern browsers(IE 11+). Supports jQuery-like syntax. Just 1 kb gzipped.
TypeScript
22
star
10

lg-thumbnail

Thumbnail module for lightGallery
JavaScript
12
star
11

lg-video.js

Video module for lightgallery.
JavaScript
10
star
12

lg-zoom

Zoom module for lightGallery
JavaScript
10
star
13

lg-thumbnail.js

Thumbnail module for lightgallery.
JavaScript
8
star
14

lg-fullscreen.js

Fullscreen module for lightgallery.
JavaScript
6
star
15

lg-video

Video module for lightGallery
JavaScript
6
star
16

lg-zoom.js

Zoom module for lightgallery.
JavaScript
6
star
17

lg-share

Social media share module for lightgallery.
JavaScript
5
star
18

lg-pager.js

Pager module for lightgallery.
JavaScript
3
star
19

lightgallery.js-anguar-demo

Using lightgallery.js in Angular
HTML
2
star
20

lg-fullscreen

JavaScript
2
star
21

lg-rotate

Rotate plugin for lightGallery
JavaScript
2
star
22

lightgallerywp

WordPress plugin for lightGallery
PHP
1
star
23

lg-share.js

Social media share module for lightgallery.
JavaScript
1
star
24

lg-hash

Hash module for lightGallery
JavaScript
1
star
25

lg-pager

Pager module for lightGallery
JavaScript
1
star