npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@rat.md/bs-lightbox

v1.1.1

Published

A simple Bootstrap 4 and Bootstrap 5 Lightbox system using the native Carousel and Modal components.

Downloads

13

Readme

@rat.md / bs-lightbox

bs-lightbox is a simple Lightbox system based on the Bootstrap-native Carousel and Modal components, compatible with Bootstrap 5 and Bootstrap 4.

Features

  • Compatible with Bootstrap v5 and Bootstrap v4
  • Native Lightbox environment using Bootstraps Carousel & Modal components
  • No stylesheet or CSS overwrites, just Bootstraps component & utility classes
  • Access to all Carousel & Modal options and events
  • Simple but useful API & Methods
  • Available as ES6 compiled JavaScript and as ES Module
  • Free/To/Use and written in Vanilla JS

Installation

You can download the latest release of the bs-lightbox package directly on the Release Page of the official GitHub repository, alternatively you can also receive your copy of this script using npm:

npm i @rat.md/bs-lightbox

Usage

bs-lightbox does not provide an own stylesheet, instead it just relies on the Bootstrap-native component and utility classes. Since bs-lightbox does not provide any bundled JS version, you've to make sure that Bootstrap's JavaScript library is loaded BEFORE the rat.lightbox file.

<html>
    <head>
        <!-- Include Bootstrap CSS -->
        <link href="path/to/your/css/bootstrap.min.css" />
    </head>
    <body>
        
        <!-- Simple Lightbox -->
        <img src="path/to/your/image.jpg" data-bs-handle="lightbox" />

        <!-- Include Bootstrap JS -->
        <script src="path/to/your/js/bootstrap.bundle.min.js"></script>

        <!-- Include @rat.md/bs-lightbox JS -->
        <script src="path/to/your/js/rat.lightbox.min.js"></script>

        <!-- Invoke Lightbox on all valid components -->
        <script>
            document.addEventListener('DOMContentLoaded', () => {
                rat.Lightbox.invoke();
            });
        </script>
    </body>
</html>

Usage as ES Module

bs-lightbox does also provide an ES-Module version, which can be found in the dist/esm folder. Depending on how you're including Bootstrap, you probably need to append the Carousel and Modal prototype objects / classes manually, as shown below.

import { Carousel, Modal } from 'bootstrap';                // Optional, depending on your usage
import { Lightbox } from '../esm/rat.lightbox.min.js';

// The following lines are only necessary, if the 'bootstrap' global is not added
Lightbox.CAROUSEL = Carousel;
Lightbox.MODAL = Modal; 

// Go on as usual, make sure the following line is execute when the DOM is ready.
Lightbox.invoke(
    null,       // Custom or Default selector
    {}          // Custom Configurations
);

Copyright & License

Written and Copyright by rat.md.

Published under der MIT license.