Handle Long Press/Tap Event In JavaScript – long-press-event
Import the long-press.js library into your html document.
<script src="dist/long-press.min.js"></script>
Attach the long press/tap event handler to a specific element.
var el = document.getElementById('demo');
el.addEventListener('long-press', function(e) {
// do something
}); Or attach the event handler to the whole document.
document.addEventListener('long-press', function(e) {
// do something
}); Customize the time delay in milliseconds. Default: 1.5s.
<div id="demo" data-long-press-delay="500">Press and hold me for .5s</div>
v2.5.2 (04/21/2026)
v2.5.0 (04/27/2024)
v2.4.6 (02/25/2023)
v2.4.4 (05/25/2021)
v2.4.2 (11/16/2020)
v2.4.1 (11/15/2020)
v2.1.0 (09/23/2019)
v2.0.1 (09/08/2019)
v2.0.0 (08/29/2019)
v1.0.7 (08/28/2019)
v1.0.6 (07/02/2019)
03/21/2018
02/02/2018
09/14/2018
The post Handle Long Press/Tap Event In JavaScript – long-press-event appeared first on CSS Script.
If you’re after some new games for your Switch 2, you’re in luck, as Ninja…
A Pokémon fan has been able to fund his own wedding, after rediscovering a trio…
The DJI Mini 4K is an excellent quadcopter drone camera for beginners looking to try…
Tension: We perform listening instead of practicing presence, creating distance while appearing close. Noise: The…
Tension: The command-and-control leadership that built successful companies in 2010 now creates anxious, depleted teams.…
A crew member working on the live-action How to Train Your Dragon 2 has reportedly…
This website uses cookies.