I am using the current code:
$(\'body\').mousedown(function() {
$(\'div#extras\').fadeTo(\'fast\', 1);
});
$(\'body\').mouseup(function() {
Old post but there is universal solution:
$('body').on('mousedown touchstart',function(e){
$('div#extras').fadeTo('fast', 1);
});
$('body').on('mouseup touchend',function(e){
$('div#extras').delay(2000).fadeTo(1500, 0);
});
You will notice that I use mousedown
with touchstart
and mouseup
with touchend
. This cover mobile and desktop use.