Questions tagged [touch]

Touch-based interfaces have unique considerations that do not apply to other modes of input, and vice versa.

Touch-based interfaces are found on devices such as tablet PCs and touch-screen smartphones. The touch interfaces common today use capacitive technology designed to work well with simple finger touches. (Older, pressure-sensitive displays require the use of a stylus for accurate input.)

While touch input is similar to other two-dimensional input methods such as mice and drawing tablets, it lacks some characteristics of those other devices that are often taken for granted. For example, an on-screen cursor can be moved with a mouse to "hover" over an object without selecting it; there is no analogue to this in a touch interface because the act of pointing and selecting are both defined by a single touch.

Conversely, it is possible to do some kinds of input via touch that are difficult or impossible to represent with something like a mouse. In particular, modern "multitouch" interfaces allow two fingers to be used for pinching or stretching. Also, two or more fingers may be used to augment normal touching and dragging gestures (though this is analogous to using a mouse with alternate buttons or keyboard modifiers).

6147 questions
454
votes
37 answers

What's the best way to detect a 'touch screen' device using JavaScript?

I've written a jQuery plug-in that's for use on both desktop and mobile devices. I wondered if there is a way with JavaScript to detect if the device has touch screen capability. I'm using jquery-mobile.js to detect the touch screen events and it…
screenm0nkey
  • 16,975
  • 17
  • 53
  • 75
288
votes
15 answers

How to add a touch event to a UIView?

How do I add a touch event to a UIView? I try: UIView *headerView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, nextY)] autorelease]; [headerView addTarget:self action:@selector(myEvent:)…
Manni
  • 10,948
  • 15
  • 46
  • 67
247
votes
19 answers

Prevent Android activity dialog from closing on outside touch

I have an activity that is using the Theme.Dialog style such that it is a floating window over another activity. However, when I click outside the dialog window (on the background activity), the dialog closes. How can I stop this behaviour?
Fergusmac
  • 3,447
  • 4
  • 18
  • 21
236
votes
7 answers

Consider marking event handler as 'passive' to make the page more responsive

I am using hammer for dragging and it is getting choppy when loading other stuff, as this warning message is telling me. Handling of 'touchstart' input event was delayed for X ms due to main thread being busy. Consider marking event handler as…
Matt
  • 26,570
  • 19
  • 63
  • 74
190
votes
11 answers

android: move a view on touch move (ACTION_MOVE)

I'd like to do a simple control: a container with a view inside. If I touch the container and I move the finger, I want to move the view to follow my finger. What kind of container (layout) should I use? How to do this? I don't need to use a…
Zelter Ady
  • 5,924
  • 12
  • 44
  • 69
179
votes
15 answers

How to remove/ignore :hover css style on touch devices

I want to ignore all :hover CSS declarations if a user visits our website via touch device. Because the :hover CSS does not make sense, and it can even be disturbing if a tablet triggers it on click/tap because then it might stick until the element…
Simon Ferndriger
  • 3,580
  • 6
  • 23
  • 47
164
votes
9 answers

Binding multiple events to a listener (without JQuery)?

While working with browser events, I've started incorporating Safari's touchEvents for mobile devices. I find that addEventListeners are stacking up with conditionals. This project can't use JQuery. A standard event listener: /* option 1…
johnkreitlow
  • 1,643
  • 2
  • 11
  • 6
161
votes
28 answers

How to prevent sticky hover effects for buttons on touch devices

I have created a carousel with a previous and a next button that are always visible. These buttons have a hover state, they turn blue. On touch devices, like iPad, the hover state is sticky, so the button stays blue after tapping it. I don't want…
Chris
  • 1,763
  • 3
  • 13
  • 9
158
votes
24 answers

Detecting that the browser has no mouse and is touch-only

I'm developing a webapp (not a website with pages of interesting text) with a very different interface for touch (your finger hides the screen when you click) and mouse (relies heavily on hover preview). How can I detect that my user has no mouse to…
nraynaud
  • 4,404
  • 6
  • 37
  • 50
151
votes
13 answers

iOS - forward all touches through a view

I have a view overlayed on top of many other views. I am only using the overaly to detect some number of touches on the screen, but other than that I don't want the view to stop the behavior of other views underneath, which are scrollviews, etc. How…
sol
  • 6,112
  • 13
  • 44
  • 57
137
votes
14 answers

Disable double-tap "zoom" option in browser on touch devices

I want to disable the double-tap zoom functionality on specified elements in the browser (on touch devices), without disabling all the zoom functionality. For example: One element can be tapped multiple times for something to happen. This works fine…
Wouter Konecny
  • 2,830
  • 3
  • 17
  • 26
132
votes
10 answers

Media query to detect if device is touchscreen

What is the safest way, using media queries, to make something happen when not on a touchscreen device? If there is no way, do you suggest using a JavaScript solution such as !window.Touch or Modernizr?
JJJollyjim
  • 5,117
  • 17
  • 54
  • 78
124
votes
5 answers

Javascript Drag and drop for touch devices

I am looking for a drag & DROP plugin that works on touch devices. I would like similar functionality to the jQuery UI plugin which allows "droppable" elements. The jqtouch plugin supports dragging, but no dropping. Here is drag & drop that only…
joe
  • 15,556
  • 35
  • 90
  • 129
122
votes
4 answers

jquery-ui sortable | How to get it work on iPad/touchdevices?

How do I get the jQuery-UI sortable feature working on iPad and other touch devices? http://jqueryui.com/demos/sortable/ I tried to using event.preventDefault();, event.cancelBubble=true;, and event.stopPropagation(); with the touchmove and the…
eventhorizon
  • 3,459
  • 3
  • 14
  • 9
122
votes
14 answers

How do I simulate a hover with a touch in touch enabled browsers?

With some HTML like this:

Some Text

Then some CSS like this: p { color:black; } p:hover { color:red; } How can I allow a long touch on a touch enabled device to replicate hover? I can change markup/use JS etc, but can't think of an…
Rich Bradshaw
  • 67,265
  • 44
  • 170
  • 236
1
2 3
99 100