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
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...');
});
There is no truly native way to accomplish this. You can check out this solution for a good workaround using jquery's draggable plugin.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.