Cursometer | jQuery plug-in for capturing cursor speed | Plugin library
kandi X-RAY | Cursometer Summary
kandi X-RAY | Cursometer Summary
jQuery plug-in for capturing cursor speed.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Cursometer
Cursometer Key Features
Cursometer Examples and Code Snippets
Community Discussions
Trending Discussions on Cursometer
QUESTION
(Firstly, let me say that the code for this is in my github repo: Click Here)
The repo should give you all the clues necessary to what the issue is, however if you were to open up the index.html
file and click, a counter should start in the top left corner. It seems to work perfectly for a bit, however if you click a lot and drag the mouse and move it around the page for a bit, the counter suddenly goes insane and counting rapidly.
I can't find where the issue is with the code doing this; I gave setInterval()
a specific time to update timer
, however after moving the mouse, a bunch of clicks, and dragging the mouse, etc...the counter goes crazy. Normally it wouldn't be too bad of an issue, however the site I am implementing this on requires a lot of clicks and mouse movement.
My next issue is that I cannot find a way to stop counting on mouseup
. At the moment, when mouse is down OR up, the counter count. However, I want it to start counting when left-click is held, and stop when I take my finger off left click. I've tried a while
loop like while (mouseDown === true) ...
and that just doesn't load the page correctly.
Any help is appreciated!
...ANSWER
Answered 2019-Jul-23 at 15:55You call setInterval()
with every click, but you never clear out the previous one. If I click 10 times, that's now 10 concurrent intervals.
If you declare
cancel at the root with the rest of your variables, you can access it from within your click event. This allows you to clear it out before you reset it.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Cursometer
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page