Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@firstandthird/carousel

Package Overview
Dependencies
Maintainers
6
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@firstandthird/carousel

Simple carousel

  • 2.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
6
Created
Source

Simple Carousel.

Installation

npm install @firstandthird/carousel

Module Options

OptionTypeDefaultDescription
autoslide{Number}0Disabled by default. Number of milliseconds to autoslide to next one
match{String}-Media query on which the carousel shouldn't work with touch events. Useful if you want to disable touch events on tablets
transformsEnabled{Boolean}falseBy default, slides won't have a transform animation. If this is true they'll have a transform applied to them whenever the page is changed
transformOn{String}-This overwrites the above an only enables transform on a given media query

Methods

play()

Starts autosliding the carousel.

pause()

Stops the carousel.

goToPage(index)

Navigates the carousel to a given slide. Needs parameter index (1 based).

Parameters

index - {Number} - Slide index

goPrev()

Allows an element (preferably a button) to go to the previous slide once clicked (if possible).

goNext()

Allows an element (preferably a button) to go to the next slide once clicked (if possible).

Events

A custom event carousel:slide:change is fired on every slide change.

Example markup

<section class="carousel" data-module="Carousel" data-module-autoslide="4000">
  <div data-carousel-slides>
    <div data-carousel-slide></div>
    <div data-carousel-slide></div>
    <div data-carousel-slide></div>
    <div data-carousel-slide></div>
  </div>

  ... content

  <div data-carousel-slides>
    <div data-carousel-slide></div>
    <div data-carousel-slide></div>
    <div data-carousel-slide></div>
    <div data-carousel-slide></div>
  </div>


  <ul class="carousel-controls">
    <li><button class="carousel-control" data-action="changeSlide" data-action-index="1" aria-selected="true"></button></li>
    <li><button class="carousel-control" data-action="changeSlide" data-action-index="2" aria-selected="false"></button></li>
    <li><button class="carousel-control" data-action="changeSlide" data-action-index="3" aria-selected="false"></button></li>
    <li><button class="carousel-control" data-action="changeSlide" data-action-index="4" aria-selected="false"></button></li>
  </ul>
</section>

There are more examples here.

Keywords

FAQs

Package last updated on 02 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc