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

flexicarousel

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flexicarousel

A carousel that'll use CSS to dynamically adapt its width. Uses transforms for its transitions and is touch-enabled

  • 0.5.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-50%
Maintainers
2
Weekly downloads
 
Created
Source

Flexicarousel

A carousel that'll use CSS to dynamically adapt its width. Uses transforms for its transitions and is also touch-enabled.

Introduction

The general idea is that this component should maintain a separation of state and style. That is to say, the Javascript maintains the state of the carousel (which slide, etc), while the CSS should take care of the presentation of this state (ie. transitions between slides, responsive, etc).

Overview

Features a touch-based interface, simple API, and a very-lightweight footprint. It does the basics well, but that's it. No bloat. You can swipe to drag a slide yet still use CSS to control how the slide transitions will behave. You can also choose to change slides by using the exposed API. The carousel works on both desktop and mobile, and weighs in at less than 2 KB(!)

Getting Started

Checkout the Github repo.

There is an ES6 module you may consume however you wish. Alternatively, you can also include the relevant scripts in your web page, and then:


	// availble options
	var options = {
		onSlide: someFunction,
		activeClass: 'active',
		slideWrap: 'ul',
		slides: 'li',
		infinite: true,
		display: 1,
		disableDragging: false
	};

	var container = document.querySelector('.carousel');
	var carousel = new Carousel(container, options);

Options

nametypedefaultdescription
onSlidefunctionundefinedA function to execute on slide. It is passed to and from indices.
activeClassstringactiveClass to use on the active slide.
slideWrapstring.wrapThe selector to use when searching for the slides' container. This is used only to bind touch events to, on mobile.
slidesstringliThe selector to use when searching for slides within the slideWrap container.
infinitebooleantrueEnable an infinitely scrolling carousel or not
displayinteger1the maximum # of slides to display at a time. If you want to have prev/next slides visible outside those currently displayed, they'd be included here.
disableDraggingbooleanfalseif you'd like to disable the touch UI for whatever reason

Methods

methoddescription
next()Next Slide: advances carousel to the next slide
prev()Previous Slide: move carousel to the previous slide
to(i)Go To Slide: advance carousel to the ith slide
destroy()Destroy: destroys carousel and removes all eventListeners

Demo

After cloning the repo:

npm i
gulp

A server will spin up at http://localhost:8003, where can play with Flexicarousel.

Support

  • IE8+
  • Safari / Chrome
  • Firefox
  • iOS
  • Android

Known Issues

Examples

Please see the test / demo directory

Release History

0.5

  • added destroy()
  • added some tests

0.4

  • better dragging response
  • fixed click bug when dragging

0.3

  • cleaning up cloning logic
  • further optimizations

0.2

  • bug fixes, mostly
  • updated slide engine
  • more robust dragging on mobile

0.1

  • first release

Keywords

FAQs

Package last updated on 16 Jul 2016

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