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

rs-carousel

v1.2.2

Published

Customizable basic fullpage carousel

Downloads

9

Readme

License GitHub version NPM version Downloads

RS Carousel

Customizable basic fullpage carousel

Features

  • Easy extensible
  • Written in ES6
  • Progressive background image loading with blur (like medium.com)

Example

ES6 basic - demo

ES6 horizontal - demo

ES6 custom controls - demo

Or see example dir

Installation

npm install rs-carousel

Dependencies

jQuery and Velocityjs

Usage

import { RSBaseCarousel } from 'rs-carousel';

const $container = $('.js-carousel');
const carousel = new RSBaseCarousel($container, opts);

Lazy loading background images

Use attributes for urls of images

<div class="m-carousel__slide js-rs-carousel__slide">
    <div class="js-rs-carousel__slide__bg" data-image-small="img_small.jpg" data-image="img_large.jpg"></div>
    ...
</div>

Options

| Option | Type | Default | Description | | ------ | ---- | ------- | ----------- | | slideSel | string | '.js-rs-carousel__slide' | Carousel elements selector | | slideBgSel | string | '.js-rs-carousel__slide__bg' | Slide background selector | | slideBgCanvasClass | string | 'bg-canvas' | Class for slide background canvas (used for blur small background image) | | slideBgImgClass | string | 'bg-img' | Class for slide background element (used for full background image) | | slideBgImgStyles | object | { backgroundPosition: 'center center', backgroundSize: 'cover' } | Css for background element | | slideBgImgLoadingClass | string | 'bg-img-loading' | Class form slide background element while loading full image | | slideBgImgLoadedClass | string | 'bg-img-loaded' | Class for slide background element when loaded full image | | slideBgImgFadeDuration | number | 500 | Duration of animation backgrounds | | blurRadius | number | 30 | Used for blur small background image | | slideZIndex | number | 1000 | Carousel elements z-index | | swipeThreshold | number | 30 | Minimal distance required before slides change | | duration | number | 1000 | Animation duration | | direction | number | 24 | Carousel direction (see constants) | | easing | string | 'easeInOutCubic' | Animation easing (see velocityjs easings) | | infinite | boolean | true | Infinite looping |

Constants

import { constants } from 'rs-carousel';

console.log(constants);
{
    directions: {
        left: 2,
        right: 4,
        up: 8,
        down: 16,
        vertical: 24,
        horizontal: 6
    },
    animationsNames: {
        in: {
            "2": "carouselSlideLeftIn",
            "4": "carouselSlideRightIn",
            "8": "carouselSlideUpIn",
            "16": "carouselSlideDownIn"
        },
        out: {
            "2": "carouselSlideLeftOut",
            "4": "carouselSlideRightOut",
            "8": "carouselSlideUpOut",
            "16": "carouselSlideDownOut"
        }
    }
}

Api

Methods and props

Methods and props are called on carousel instances

const carousel = new RSBaseCarousel($container, opts);

carousel.goTo(2); // Method
carousel.currentSlide; // Prop

| Method | Argument | Description | | ------ | -------- | ----------- | | goTo | index : number | Goes to slide by index | | next | | Goes to next slide | | prev | | Goes to next slide | | addBeforeCb | fn : function | Add before slide change callback | | addAfterCb | fn : function | Add after slide change callback | | lock | | Lock carousel | | unlock | | Unlock carousel |

| Prop | Description | | ---- | ----------- | | currentSlide | Current slide | | nextIndex | Next slide index | | prevIndex | Prev slide index | | $container | Constainer of carousel instance | | settings | Carousel settings of current instance |

Build (for developers)

npm run build

License

Released under the MIT License. See the bundled LICENSE file for details.