Socket
Socket
Sign inDemoInstall

react-responsive-carousel

Package Overview
Dependencies
1
Maintainers
1
Versions
121
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.3 to 0.1.4

29

components/Carousel.js

@@ -146,2 +146,13 @@ /** @jsx React.DOM */

var delta = e.touches[0].pageX - this.state.touchStart;
var leftBoundry = 0;
var lastLeftBoundry = - this.itemSize * (this.props.items.length - 1);
//if the first image meets the left boundry, prevent user from swiping left
if (this.currentPosition === leftBoundry && delta > 0) {
delta = 0;
}
//if the last image meets the left boundry, prevent user from swiping right
if (this.currentPosition === lastLeftBoundry && delta < 0) {
delta = 0;
}
// real position

@@ -180,8 +191,14 @@ var position = this.currentPosition + delta;

function () {
// less than 0 means that it's going left
if (this.touchPosition < 0) {
this.slideLeft();
} else {
this.slideRight();
}
if (this.touchPosition === 0) {
/* prevent users from swipe right on the first image
but it goes to the opposite direction, as the delta is alwsys 0
when swipe right on the first image.
also prevent users from swipe left on the last image from the same reason.
*/
} else if (this.touchPosition < 0) {
// less than 0 means that it's going left
this.slideLeft();
} else if (this.touchPosition > 0) {
this.slideRight();
}
// discard the position

@@ -188,0 +205,0 @@ this.touchPosition = null;

{
"name": "react-responsive-carousel",
"version": "0.1.3",
"version": "0.1.4",
"description": "React Responsive Carousel",

@@ -5,0 +5,0 @@ "author": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc