Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
swipe-js-iso
Advanced tools
[![npm version](http://badge.fury.io/js/swipe-js-iso.svg)](http://badge.fury.io/js/swipe-js-iso) [![Download Count](http://img.shields.io/npm/dm/swipe-js-iso.svg?style=flat)](http://www.npmjs.com/package/swipe-js-iso) <a href="https://www.buymeacoffee.com
Fork of original Swipe in order to be published to NPM (has no deps) and being compatible with universal apps.
npm install swipe-js-iso --save
✅ PRO HINT: Use ReactSwipe component
Swipe only needs to follow a simple layout pattern. Here is an example:
<div id="slider" class="swipe">
<div class="swipe-wrap">
<div></div>
<div></div>
<div></div>
</div>
</div>
Above is the initial required structure – a series of elements wrapped in two containers. Place any content you want within the items. The containing div will need to be passed to the Swipe function like so:
const mySwipe = Swipe(document.getElementById('slider'));
I always place this at the bottom of the page, externally, to verify the page is ready.
Also Swipe needs just a few styles added to your stylesheet:
.swipe {
overflow: hidden;
visibility: hidden;
position: relative;
}
.swipe-wrap {
overflow: hidden;
position: relative;
}
.swipe-wrap > div {
float: left;
width: 100%;
position: relative;
}
Swipe can take an optional second parameter– an object of key/value settings:
startSlide Integer (default:0) - index position Swipe should start at
speed Integer (default:300) - speed of prev and next transitions in milliseconds.
widthOfSiblingSlidePreview Integer - Width of next and previous slide preview in pixels
auto Integer - begin with auto slideshow (time in milliseconds between slides)
continuous Boolean (default:true) - create an infinite feel with no endpoints
disableScroll Boolean (default:false) - stop any touches on this container from scrolling the page
stopPropagation Boolean (default:false) - stop event propagation
swiping Function - invoked while swiping with the percentage (0-1) of the full width that has been swiped.
callback Function - runs at slide change.
transitionEnd Function - runs at the end slide transition.
const mySwipe = new Swipe(document.getElementById('slider'), {
startSlide: 2,
speed: 400,
widthOfSiblingSlidePreview: 10,
auto: 3000,
continuous: true,
disableScroll: false,
stopPropagation: false,
callback: function(index, elem) {},
transitionEnd: function(index, elem) {}
});
Swipe exposes a few functions that can be useful for script control of your slider.
prev()
slide to prev
next()
slide to next
getPos()
returns current slide index position
getNumSlides()
returns the total amount of slides
slide(index, duration)
slide to set index position (duration: speed of transition in milliseconds)
disableScrolling(disableScroll)
directly control scrolling (disableScroll: same as the config option )
Swipe is now compatible with all browsers, including IE7+. Swipe works best on devices that support CSS transforms and touch, but can be used without these as well. A few helper methods determine touch and CSS transition support and choose the proper animation methods accordingly.
MIT License
FAQs
[![npm version](http://badge.fury.io/js/swipe-js-iso.svg)](http://badge.fury.io/js/swipe-js-iso) [![Download Count](http://img.shields.io/npm/dm/swipe-js-iso.svg?style=flat)](http://www.npmjs.com/package/swipe-js-iso) <a href="https://www.buymeacoffee.com
The npm package swipe-js-iso receives a total of 10,354 weekly downloads. As such, swipe-js-iso popularity was classified as popular.
We found that swipe-js-iso demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.