JSFiddle - React, Tailwind, and code Playground
HTML
<a id="clickMe" href="#">click</a>
JavaScript
(function($, w, timer) {
var clicker = $('#clickMe'),
doStuff = function(repeat) {
//bei mouseup timer entfernen, sonst weitermachen
if( !repeat || (clicker.data( 'hover' ) == 0) ) {
w.clearTimeout(timer);
return true;
}
//console.log( "hover data: " + clicker.data( 'hover' ) );
console.log('jo');
timer = w.setTimeout(function() {
clicker.trigger('mousedown');
}, 50);
};
clicker.hover( function() {
$( this ).data( 'hover', 1 );
clicker.on('mousedown mouseup', function(e) {
doStuff(e.type === 'mousedown');
});
}, function() {
$( this ).data( 'hover', 0 );
} );
})(jQuery, window);