Socket
Socket
Sign inDemoInstall

easy-float

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.2 to 1.0.3

2

package.json
{
"name": "easy-float",
"version": "1.0.2",
"version": "1.0.3",
"description": "Easy Float",

@@ -5,0 +5,0 @@ "main": "./src/index.js",

@@ -11,3 +11,6 @@ # Install

const options = {
const easyFloat = new EasyFloat();
const container = document.querySelector('body');
const targetBtn = document.querySelector('.btn');
easyFloat.init({
container,

@@ -20,5 +23,7 @@ targetBtn,

fadeOutTime: 1000,
};
easyFloat.init();
});
targetBtn.addEventListener('click', () => {
if (!easyFloat.canClick) return;
alert('do click');
});
```

@@ -25,0 +30,0 @@

@@ -17,2 +17,5 @@ export default class EasyFloat {

this.fadeOutEnable = false;
this.totalMovementX = 0;
this.totalMovementY = 0;
this.canClick = true;
this.timer = null;

@@ -119,2 +122,3 @@ this.fadeOutTimer = null;

this.targetBtn.style.transition = '';
this.canClick = true;
}, 300);

@@ -184,3 +188,2 @@

this.targetBtn.addEventListener(startEvent, (e) => {
e.preventDefault();
clearTimeout(this.timer);

@@ -190,2 +193,4 @@ clearTimeout(this.fadeOutTimer);

this.dragStart = true;
this.totalMovementX = 0;
this.totalMovementY = 0;

@@ -208,2 +213,5 @@ if (startEvent === 'mousedown') {

const movementY = e.movementY;
this.totalMovementX += movementX;
this.totalMovementY += movementY;
const newLeft = this.targetBtn.offsetLeft + movementX;

@@ -223,3 +231,9 @@ const newTop = this.targetBtn.offsetTop + movementY;

this.initialY = touch.clientY;
this.totalMovementX += movementX;
this.totalMovementY += movementY;
}
if (Math.abs(this.totalMovementY) >= 5 || Math.abs(this.totalMovementX) >= 5) {
this.canClick = false;
}
});

@@ -232,2 +246,6 @@

}
clearListener() {
window.removeEventListener('resize', this.computePositionBind);
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc