Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

does mousedown /mouseup in jquery work for the ipad?

I am using the current code:

$('body').mousedown(function() {         $('div#extras').fadeTo('fast', 1); });  $('body').mouseup(function() {         $('div#extras').delay(2000).fadeTo(1500, 0); }); 

This works great in safari but when I upload it and check it out on the ipad it doesnt work?

like image 252
Annie Avatar asked Jul 21 '10 20:07

Annie


People also ask

Is Mousedown the same as click?

Note: This differs from the click event in that click is fired after a full click action occurs; that is, the mouse button is pressed and released while the pointer remains inside the same element. mousedown is fired the moment the button is initially pressed.

What is Mouseup and Mousedown?

MouseDown occurs when the user presses the mouse button; MouseUp occurs when the user releases the mouse button.

What is Mousedown in jQuery?

jQuery mousedown() MethodThe mousedown event occurs when the left mouse button is pressed down over the selected element. The mousedown() method triggers the mousedown event, or attaches a function to run when a mousedown event occurs. Tip: This method is often used together with the mouseup() method.

What is Mouseup in jQuery?

jQuery mouseup() The mouseup() method adds an event handler function to an HTML element. This function is executed, when the left mouse button is released after pressing mouse button on the HTML element. The mouseup () event occurs when you release the pressed button of your mouse over a selected element.


2 Answers

I found out how to do this for the ipad for those who are interested:

Instead of the code I used in my question, you would use:

$('body').bind( "touchstart", function(e){         $('div#extras').fadeTo('fast', 1); }); 

&

$('body').bind( "touchend", function(e){         $('div#extras').delay(2000).fadeTo(1500, 0); }); 
like image 169
Annie Avatar answered Sep 20 '22 13:09

Annie


Not exactly.

Apple Docs

Quote:

A clickable element is a link, form element, image map area, or any other element with mousemove, mousedown, mouseup, or onclick handlers. A scrollable element is any element with appropriate overflow style, text areas, and scrollable iframe elements. Because of these differences, you might need to change some of your elements to clickable elements, as described in “Making Elements Clickable,” to get the desired behavior in iPhone OS.

(emphasis mine)

like image 38
scunliffe Avatar answered Sep 22 '22 13:09

scunliffe