Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
flexicarousel
Advanced tools
A carousel that'll use CSS to dynamically adapt its width. Uses transforms for its transitions and is touch-enabled
A carousel that'll use CSS to dynamically adapt its width. Uses transforms for its transitions and is also touch-enabled.
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).
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(!)
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);
name | type | default | description |
---|---|---|---|
onSlide | function | undefined | A function to execute on slide. It is passed to and from indices. |
activeClass | string | active | Class to use on the active slide. |
slideWrap | string | .wrap | The selector to use when searching for the slides' container. This is used only to bind touch events to, on mobile. |
slides | string | li | The selector to use when searching for slides within the slideWrap container. |
infinite | boolean | true | Enable an infinitely scrolling carousel or not |
display | integer | 1 | the 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. |
disableDragging | boolean | false | if you'd like to disable the touch UI for whatever reason |
method | description |
---|---|
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 |
After cloning the repo:
npm i
gulp
A server will spin up at http://localhost:8003
, where can play with Flexicarousel.
Please see the test / demo directory
FAQs
A carousel that'll use CSS to dynamically adapt its width. Uses transforms for its transitions and is touch-enabled
The npm package flexicarousel receives a total of 1 weekly downloads. As such, flexicarousel popularity was classified as not popular.
We found that flexicarousel demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.