swipe-js-iso is a lightweight, dependency-free JavaScript library for creating touch-enabled carousels and sliders, specifically forked from the original Swipe.js project. It aims to be compatible with 'universal' (isomorphic) applications, meaning it can theoretically be used in both browser and server-side rendering contexts (though typically client-side focused for DOM manipulation). The current stable version is 2.1.5, with the last publish being 7 years ago, suggesting a maintenance or inactive release cadence rather than active development. Its key differentiators include its minimal footprint and lack of external dependencies, providing a simple, performant solution for basic image or content swiping, particularly when alternatives like Swiper.js might be considered too heavy or feature-rich.
npm install swipe-js-isoVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to set up a basic swipeable carousel using `swipe-js-iso` with HTML, CSS, and JavaScript. It initializes the slider, configures common options like auto-play and transition speed, and exposes API methods (`prev`, `next`) for external controls.
For actively maintained and feature-rich sliders, consider alternatives like Swiper.js, which is under active development. If `swipe-js-iso` meets minimal needs, thoroughly test its compatibility and performance in your target environments.
Always ensure the exact HTML markup (`<div class="swipe"><div class="swipe-wrap"><div></div></div></div>`) and the provided essential CSS rules are applied. Inspect the DOM and computed styles for debugging layout issues.
When using in universal/isomorphic applications, ensure `Swipe` initialization is guarded by a check for a browser environment (e.g., `if (typeof window !== 'undefined')`) or use a library like JSDOM for server-side DOM emulation if strict SSR is required.
Ensure you have a sufficient number of slides (typically at least three, more if `widthOfSiblingSlidePreview` is used) for the `continuous` option to work effectively. For a finite set of slides where continuity is not needed, set `continuous: false`.
Ensure the DOM element exists and the script is executed after the element is available (e.g., at the end of `<body>` or inside `DOMContentLoaded` event listener). Verify the ID (`'slider'`) matches the HTML element's ID.
For ESM, use `import Swipe from 'swipe-js-iso';`. For CommonJS, use `const Swipe = require('swipe-js-iso');`. For global script tags, ensure the `swipe-js-iso` script is loaded before your custom script attempts to use `Swipe`.Copy the essential CSS styles provided in the `README` exactly into your stylesheet. Use browser developer tools to inspect the elements and verify that the styles are correctly applied and not being overridden.
No dependency data recorded yet.