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

@rohanacharya/imagecarousel

v1.0.0

Published

A image carousel component able to formulate an image slideshow.

Downloads

1

Readme

Carousel Component

A lightweight and customizable image carousel component for your web projects. This carousel component supports navigation through images via buttons and indicator dots. It is implemented in plain JavaScript and requires the accompanying CSS for proper styling.

Features

  • Navigate through images using previous and next buttons.
  • Click on indicator dots to jump to a specific slide.
  • Automatically advances to the next slide every 5 seconds.

Installation

To use the Carousel component, you need to include the JavaScript and CSS files in your project. Follow these steps:

  1. Install the Package:

    If you're using npm, you can install the package via:

    npm install @rohanacharya/imagecarousel
  2. Include the JavaScript and CSS Files:

    After installation, you need to include the carousel.js and carousel.css files in your project. Make sure to add these files to your HTML.

    <link rel="stylesheet" href="node_modules/@rohanacharya/imagecarousel/dist/styles.css" />
    <script src="node_modules/@rohanacharya/imagecarousel/dist/index.js"></script>

    Alternatively, if you are using a build tool, you can import the CSS and JS directly into your project's entry file:

    import Carousel from "@rohanacharya/imagecarousel";
  3. Initialize the Carousel:

    Use JavaScript to initialize the carousel component:

    document.addEventListener("DOMContentLoaded", () => {
      new Carousel(".carousel-container", ".carousel-image");
    });

Usage

Add the following HTML structure to your page:

<div class="carousel-container">
  <div class="carousel-wrapper">
    <img src="image1.jpg" class="carousel-image" />
    <img src="image2.jpg" class="carousel-image" />
    <img src="image3.jpg" class="carousel-image" />
    <!-- Add more images as needed -->
  </div>
  <button class="carousel-control prev">Prev</button>
  <button class="carousel-control next">Next</button>
</div>

Initialize the carousel in your JavaScript:

import Carousel from "@rohanacharya/imagecarousel";

const carousel = new Carousel(".carousel-container", ".carousel-image");

Styling

To ensure that the carousel is displayed correctly, you must include the CSS file provided with this package. The CSS file sets up the basic layout and styling for the carousel component. Without it, the carousel may not appear as intended. Or you can just copy and paste the stylings into your own stylesheet and then no need to link the given stylesheet to your project.

API

Constructor: Carousel(mainContainer, images)

  • mainContainer (string): Selector for the carousel container.
  • images (string): Selector for the images inside the carousel.

Customization

For now, this component comes with default styling. Future updates might include customization options.

Contributing

If you'd like to contribute to this project, please fork the repository and submit a pull request.