1.1.36 • Published 8 months ago

stlightbox v1.1.36

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

Stlightbox - JavaScript Lightbox Plugin

Stlightbox is a lightweight and customizable JavaScript lightbox plugin that allows you to display images and videos in a beautiful overlay with various configuration options.

Features

  • Display images and videos in a responsive lightbox.
  • Customizable appearance and behavior.
  • Keyboard navigation for easy gallery navigation.
  • Download button for image downloads.
  • Pagination support to show the current image position.
  • Dark and light themes with automatic theme detection.

Installation

You can install Stlightbox by including the JavaScript and CSS files in your project. You can download the latest release from the GitHub repository or use a package manager like npm or yarn:

npm install stlightbox

Usage

To use Stlightbox in your project, follow these simple steps:

  1. Include the CSS in your h:
<link rel="stylesheet" href="path/to/stlightbox.css" />

<script src="path/to/stlightbox.js"></script>
  1. Wrap your image or video i tag with the same href. Add the data-stlightbox attribute to the tag you want to include in the lightbox:
<!-- FIRST GALLERY -->
<a href="image1.jpg" data-stlightbox="stellar-solutions">
    <img src="image1.jpg" alt="Image 1" />
</a>
<a href="image2.jpg" data-stlightbox="stellar-solutions">
    <img src="image2.jpg" alt="Image 2" />
</a>

<!-- SECOND GALLERY -->
<a href="image3.jpg" data-stlightbox="stl-gallery">
    <img src="image3.jpg" alt="Image 3" />
</a>
<a href="image4.jpg" data-stlightbox="stl-gallery">
    <img src="image4.jpg" alt="Image 4" />
</a>
  1. Initialize Stlightbox in your JavaScript code:
const lightbox = new Stlightbox({
    // Configuration options (see below)
});

lightbox.initialize();
  1. Customize the appearance and behavior of the lightbox by providing configuration options (see the Configuration section below).

Configuration

You can customize the behavior and appearance of Stlightbox by passing configuration options when initializing it. Here are the available options:

OptionDescriptionDefault Value
lightThemeBackgroundBackground color for the light theme'rgba(255, 255, 255, 0.5)'
darkThemeBackgroundBackground color for the dark theme'rgba(100, 100, 100, 0.5)'
showDownloadButtonShow a download button for imagesfalse
keyboardControlsEnable keyboard navigationtrue
videoAutoplayAutoplay videos in the lightboxfalse
paginationEnable paginationfalse
paginationSeparatorSeparator between current and total in pagination'of'
loopEnable loop navigationfalse

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Icons used in the lightbox are provided by Heroicons.

Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request.

1.1.36

8 months ago

1.1.34

8 months ago

1.1.33

8 months ago

1.1.32

8 months ago

1.1.31

8 months ago

1.1.3

8 months ago

1.1.22

8 months ago

1.1.21

8 months ago

1.1.2

8 months ago

1.1.1

8 months ago

1.1.0

8 months ago

1.0.2

8 months ago

1.0.1

8 months ago

1.0.0

8 months ago