Reputation: 55
I am working on a project in which i want a menu to appear on screen whenever it is touched and hold. So I want to know that just like button click and hover property in CSS is there any way to implement click and hold property, if no then how it can be done using javascript or jquery.
thanks
Upvotes: 0
Views: 2138
Reputation: 690
You can do this using jQuery, a combination of mousedown
, mouseup
and mouseleave
<button class="testHold">click and hold me</button>
<div class="tracker"></div>
$('.testHold').mousedown(function() {
$('.tracker').html("holding holding holding");
}).bind('mouseup mouseleave', function() {
$('.tracker').text('free as a bird...');
});
Upvotes: 1
Reputation: 450
There is no truly native way to accomplish this. You can check out this solution for a good workaround using jquery's draggable plugin.
Upvotes: 0