I'm working on a web application for Work and we're working towards recreating an existing desktop application on a web page (don't get me started on that one!).
Anyway, traditional applications have 'spinners' that make numbers or items go up and down (I'm working on that too). This jQuery plugin adds the missing 'repeat' event.
Download the mousehold plugin.
UK EVENTAttend ffconf.org 2024
The conference for people who are passionate about the web. 8 amazing speakers with real human interaction and content you can't just read in a blog post or watch on a tiktok!
£249+VAT - reserve your place today
The 'repeat' is when you keep a key pressed down and it keeps printing the character, or you keep the mouse button pressed down and it keeps firing the click event.
The plugin works by setting a 'mousedown' event and keeps firing the function at the given interval until the 'mouseup' event or the mouse moves off the element.
This last logic is because if it wasn't in place, the function specified would keep firing (since the mouse up event fired, but not on the element we set it on).
Feedback and so on is welcome.