
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
flickity-responsive
Advanced tools
A vanilla JS plugin that adds
responsive
option for Flickity. And more extendable settings, see #docs
At the time of this plugin was made, Flickity does not officially offer any way to update the options on various screen-sizes.
Read more about the issue here š https://github.com/metafizzy/flickity/issues/233
So, I create a plugin that brings responsive
to Flickity, just like the
way Slick works.
Add the script to your project in this order š
flickity-responsive
Install NPM package
npm i flickity-responsive
Import
import {FlickityResponsive} from "flickity-responsive";
š Self hosted - Download the latest release
<script src="./flickity-responsive.min.js"></script>
š CDN Hosted - jsDelivr
<script src="https://cdn.jsdelivr.net/gh/phucbm/flickity-responsive@2.1.5/flickity-responsive.min.js"></script>
Just change the name, all other options stay the same.
// init with vanilla JS
const carousel = new FlickityResponsive('.carousel', {
pageDots: false,
responsive: [
{
breakpoint: 768,
settings: {
prevNextButtons: false,
pageDots: true,
}
}
]
});
Use data attribute to init Flickity Responsive, just exactly like Flickity.
<div data-flickity-responsive='{ "cellAlign": "left", "contain": true }'>
<div class="carousel-cell"></div>
<div class="carousel-cell"></div>
<div class="carousel-cell"></div>
</div>
ā ļø Options set in HTML must be valid JSON.
Visit https://flickity.netlify.app for examples.
const carousel = new FlickityResponsive('.carousel', {
contain: true, // default in Flickity Responsive
// Extra features š
// destroy
destroy: false,
// custom arrows
prevArrow: undefined, // DOM element, jQuery element
nextArrow: undefined, // DOM element, jQuery element
// indicator numbers
indicatorCurrent: undefined, // current slides, DOM element, jQuery element
indicatorTotal: undefined, // total slides, DOM element, jQuery element
// hide navigation elements if the slider is not slide-able
responsiveNavigation: true,
// indicator
indicatorZeroPad: false,
indicatorCurrent: undefined,
indicatorTotal: undefined,
// force move
forceMove: true, // make sure that every time an arrows clicked, the carousel will move
// aria hidden focus
ariaHiddenFocus: true, // Add tabindex="-1" to all elements with or inside aria-hidden="true"
ariaHiddenFocusSelector: `[aria-hidden="true"] a, [aria-hidden="true"] button`,
});
This plugin respects Flickity's API and use matchMedia()
to know when to destroy and re-initialize the
carousel.
ā ļø Important note: the
breakpoint
property is using CSSmax-width
logic. For instance, when you setbreakpoint:480
, that means responsive settings will be applied when the viewport is<=480px
(while Slick is<480px
). Let's be cleared š
Before release, update version in package.json
and README.md
.
# Run dev server
npm run dev
# Generate prod files
npm run prod
# Publish package
npm publish
# build
npm run build
Copyright (c) 2021-2025 Phuc Bui
Please leave a star āļø to support my work. Thank you!
FAQs
Responsive option for Flickity.
The npm package flickity-responsive receives a total of 17 weekly downloads. As such, flickity-responsive popularity was classified as not popular.
We found that flickity-responsive demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.Ā It has 1 open source maintainer 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.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.