https://github.com/prod3v3loper/js-element-move
Javascript move element with mouse
https://github.com/prod3v3loper/js-element-move
element elements javascript mouse move pure pure-javascript
Last synced: about 1 month ago
JSON representation
Javascript move element with mouse
- Host: GitHub
- URL: https://github.com/prod3v3loper/js-element-move
- Owner: prod3v3loper
- License: mit
- Created: 2019-03-13T21:18:02.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-03-18T20:45:14.000Z (about 7 years ago)
- Last Synced: 2025-05-15T00:21:47.401Z (about 1 year ago)
- Topics: element, elements, javascript, mouse, move, pure, pure-javascript
- Language: JavaScript
- Homepage: https://www.tnado.com/blog/javascript-move-a-div-element-with-the-mouse/
- Size: 3.91 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JS Element Move
Use JavaScript to move the elements correctly.
- mousedown
- mouseup
- mousemove
[Mouse Events Tutorial](https://www.tnado.com/blog/javascript-move-div-with-the-mouse/)
For touch devices use the touch events.
- touchstart
- touchend
- touchmove
First check if you are in a touch device. So you can act accordingly and initiate what is needed.
[Detect touch](https://stackoverflow.com/questions/4817029/whats-the-best-way-to-detect-a-touch-screen-device-using-javascript)
```js
function is_touch_device() {
return 'ontouchstart' in window;
}
```
But the touch will not work on all devices with this calculation, there comes from me separately still a section here purely soon.
# Contribute
Please [file an issue](https://github.com/prod3v3loper/js-element-move/issues) if you
think something could be improved. Please submit Pull Requests when ever
possible.
# Built with
[NetBeans](https://netbeans.org/) - NetBeans
[VSC](https://code.visualstudio.com/) - Visual Studio Code
# Authors
**Samet Tarim** - *All works*
# License
[MIT](https://github.com/prod3v3loper/js-element-move/blob/master/LICENSE) - [prod3v3loper](https://www.tnado.com/author/prod3v3loper/)