Questions tagged [touch]

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

touch
Filter by
Sorted by
Tagged with
529 votes
38 answers
660k views

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-...
screenm0nkey's user avatar
  • 18.6k
295 votes
17 answers
376k views

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 ...
Manni's user avatar
  • 11.1k
283 votes
9 answers
389k views

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 ...
Matt's user avatar
  • 34.3k
282 votes
20 answers
224k views

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 ...
Fergusmac's user avatar
  • 3,741
259 votes
18 answers
294k views

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/...
Simon Ferndriger's user avatar
232 votes
11 answers
282k views

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. ...
johnkreitlow's user avatar
  • 2,323
218 votes
30 answers
161k views

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 ...
Chris's user avatar
  • 2,353
216 votes
13 answers
247k views

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 ...
Zelter Ady's user avatar
  • 6,308
185 votes
18 answers
209k views

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 ...
Wouter Konecny's user avatar
180 votes
23 answers
72k views

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 ...
nraynaud's user avatar
  • 5,024
173 votes
13 answers
108k views

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 ...
sol's user avatar
  • 6,442
170 votes
14 answers
144k views

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 ...
JJJollyjim's user avatar
  • 5,977
144 votes
5 answers
97k views

Disable Blue Highlight when Touch/Press object with Cursor:Pointer

There is a blue highlight that appears whenever a Div that has the cursor:pointer property applied is touched in Chrome. How can we get rid of it? I have tried the following: -webkit-touch-callout: ...
Ulad Kasach's user avatar
  • 12.3k
132 votes
4 answers
161k views

Make element unclickable (click things behind it)

I have a fixed image that overlays a page when the user is in the act of scrolling a touch screen (mobile). I want to make that image "unclickable" or "inactive" or whatever, so that if a user ...
hannebaumsaway's user avatar
128 votes
15 answers
247k views

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

With some HTML like this: <p>Some Text</p> 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 ...
Rich Bradshaw's user avatar
127 votes
5 answers
78k views

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....
eventhorizon's user avatar
  • 3,589
126 votes
5 answers
144k views

Javascript Drag and drop for touch devices [closed]

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 ...
joe's user avatar
  • 17.3k
125 votes
11 answers
178k views

Disable scrolling when touch moving certain element

I have a page with a section to sketch a drawing in. But the touchmove events, at least the vertical ones, are also scrolling the page (which degrades the sketching experience) when using it on a ...
Scott Hunter's user avatar
  • 49.3k
124 votes
6 answers
146k views

Draw in Canvas by finger, Android

I need to build a project for drawing on canvas by fingers. How to get the touch event and motion event of my finger and then draw?
Sameer H. Ibra's user avatar
124 votes
21 answers
120k views

Disable hover effects on mobile browsers

I'm writing a Web site that's meant to be used from both desktops and tablets. When it's being visited from a desktop, I want the clickable areas of the screen to light up with :hover effects (...
Joe White's user avatar
  • 96.1k
119 votes
3 answers
109k views

jQuery UI slider Touch & Drag/Drop support on Mobile devices

I have already styled and implemented jQuery UI slider into a project. Though it's responsive, the slider does not respond to being touched and dragged. Instead, you have to touch where you want the ...
Seth's user avatar
  • 10.3k
115 votes
5 answers
109k views

Is there an equivalent to e.PageX position for 'touchstart' event as there is for click event?

I'm trying to get the X position with jQuery of a touchstart event, used with the live function? I.e. $('#box').live('touchstart', function(e) { var xPos = e.PageX; } ); Now, this does work with '...
waxical's user avatar
  • 3,856
113 votes
6 answers
47k views

What is meaning of boolean value returned from an event-handling method in Android

In android, most event listener methods return a boolean value. What is that true/false value mean ? what will it result in to the subsequence events ? class MyTouchListener implements ...
John Wang's user avatar
  • 4,622
96 votes
4 answers
91k views

jQuery UI sliders on touch devices

I'm developing a website using jQuery UI, and there are several elements on my site that appear to be incompatible when viewed on touchscreen devices; they don't cause any errors, but the behavior is ...
jqcoder's user avatar
  • 961
96 votes
10 answers
103k views

Eliminate 300ms delay on click events in mobile Safari

I've read that mobile Safari has a 300ms delay on click events from the time the link/button is clicked to the time the event fires. The reason for the delay is to wait to see if the user intends to ...
tim peterson's user avatar
  • 23.9k
93 votes
8 answers
75k views

Basic Drag and Drop in iOS

I want to have a view in which there are vehicles driving around that the user can also drag and drop. What do you think is the best large-scale strategy for doing this? Is it best to get touch events ...
Luke's user avatar
  • 7,150
81 votes
4 answers
79k views

Understanding touch events

I'm trying to make some of my libraries work with touch devices, but I'm having a hard time trying to figure out how they're supported and how they work. Basically, there are 5 touch events, but it ...
MaxArt's user avatar
  • 22.4k
76 votes
11 answers
83k views

Google Maps Android API v2 - detect touch on map

I can't find an example on how to intercept the map touch on the new Google Maps API v2. I need to know when the user touches the map in order to stop a thread (the centering of the map around my ...
74 votes
6 answers
134k views

Touch move getting stuck Ignored attempt to cancel a touchmove

I'm messing around with touch events on a touch slider and I keep getting the following error: Ignored attempt to cancel a touchmove event with cancelable=false, for example because scrolling is ...
souporserious's user avatar
72 votes
1 answer
33k views

Variation of e.touches, e.targetTouches and e.changedTouches

Let's say I am listening for touchstart, touchmove and touchend on the body element. Let me know if I'm wrong, but I think e.touches is the same as e.targetTouches? If so, how e.changedTouches varies ...
Andrei Zisu's user avatar
  • 4,352
72 votes
11 answers
97k views

Android How to draw a smooth line following your finger

http://marakana.com/tutorials/android/2d-graphics-example.html I am using this example below. But when I move my fingers too fast across the screen the line turns to individual dots. I am not sure ...
Somk's user avatar
  • 12k
72 votes
5 answers
56k views

Simulating touch events on a PC browser

I am developing an HTML application for the iPad. As such it utilizes touch events and webkit-CSS animations. Up until now I have used chrome as my debugging environment because of it's awesome ...
eshalev's user avatar
  • 3,083
68 votes
9 answers
132k views

Detect touch press vs long press vs movement?

I'm currently fiddling around with Android programming, but I have a small problem detecting different touch events, namely a normal touch press (press on the screen and release right away), a long ...
user avatar
67 votes
1 answer
24k views

`pointermove` event not working with touch. Why not?

I have this pen: https://codepen.io/anon/pen/eyKeqK If you try it on a touch-screen device (f.e. visit the pen on your phone) you'll notice that when you drag, the white light (the little sphere) ...
trusktr's user avatar
  • 45.6k
67 votes
11 answers
38k views

How to optimize website for touch devices

On a touch device like iPhone/iPad/Android it can be difficult to hit a small button with your finger. There is no cross-browser way to detect touch devices with CSS media queries that I know of. So I ...
63 votes
4 answers
89k views

How to programmatically trigger the touch event in android?

I would like to trigger a touch event like this: First the finger is touch down at the (0,50%) of the screen and slide to the (50%,50%) of the screen, and exit (move the finger off the screen) I ...
user782104's user avatar
  • 13.4k
63 votes
5 answers
39k views

How can a service listen for touch gestures/events?

I'm wondering how apps like SwipePad and Wave Launcher are able to detect touch gestures/events simply through a service. These apps are able to detect a touch gestures even though it is not in their ...
Brian's user avatar
  • 8,065
62 votes
5 answers
45k views

Detecting Pan Gesture End

I've got a view and I applied a UIPanGestureRecogniser to this view: UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panAnim:)]; [sliderView ...
Dan Hanly's user avatar
  • 7,829
62 votes
7 answers
44k views

Simulate touch command with Java

I want to change modification timestamp of a binary file. What is the best way for doing this? Would opening and closing the file be a good option? (I require a solution where the modification of the ...
sinuhepop's user avatar
  • 20.2k
62 votes
7 answers
57k views

Media query for devices supporting hover

I'd like to provide separate behaviour for browsers supporting hover (e.g. desktop browsers) and ones which don't (e.g. touchscreen devices). Specifically I want to declare a hover state on browsers ...
moogal's user avatar
  • 1,619
61 votes
11 answers
41k views

How do I detect if an SKSpriteNode has been touched

I am trying to detect if my sprite node has been touched and I have no idea where to start. let Pineapple = SKSpriteNode(imageNamed: "Pineappleimg") Pineapple.userInteractionEnabled = true Pineapple....
James Brennan's user avatar
60 votes
12 answers
23k views

Tooltips in the era of touch

Tooltips are an incredibly useful interface paradigm to know an application. They are the mapping between the visual control and the application specific action associated to that control. The user ...
Stefano Borini's user avatar
58 votes
5 answers
47k views

Forwarding UIGesture to views behind

I am working on an iphone (iOS 4.0 or later) app and having some troubles with touch handling between multiple views. I am having a view structure like this ---> A superView | ---> ...
Krishnabhadra's user avatar
56 votes
6 answers
52k views

JavaScript touchend versus click dilemma

I am working on some javascript UI, and using a lot of touch events like 'touchend' for improved response on touch devices. However, there are some logical issues which are bugging me ... I have seen ...
suncat100's user avatar
  • 2,146
52 votes
2 answers
38k views

Is there a way to touch-enable scrolling in a WPF ScrollViewer?

I'm trying to create a form in a WPF application that will allow the user to use iPhone-like gestures to scroll through the available fields. So, I've put all my form controls inside a StackPanel ...
Brian Sullivan's user avatar
51 votes
2 answers
53k views

touchend event properties

If I catch all touchend events from mobile devices with: $(document.body).bind('touchend', function (e) { var touch = e.touches[0]; // doesnt work ... I need to get the touch.screenX, touch.screenY, ...
Matt Roberts's user avatar
  • 26.6k
51 votes
2 answers
22k views

In Android, what is the difference between getAction() and getActionMasked() in MotionEvent?

I am confused by the two methods in Android. It seems that both methods tell you what kind of event it is, i.e., whether it is a down or up event. When will I use which? public void onTouchEvent(...
user1233587's user avatar
  • 2,053
50 votes
17 answers
85k views

How to cancel an Dialog themed like Activity when touched outside the window?

I have an activity with a Dialog theme and I would like to close (finish) this activity when someone touches the screen anywhere outside this activity's window ? How can I do this ?
Alex's user avatar
  • 2,233
50 votes
3 answers
73k views

event.originalEvent jQuery

I am currently immersed in the jQuery learning center. I'm going from start to end. I just read this paragraph: It's also important to note that the event object contains a property called ...
BryanK's user avatar
  • 1,221
49 votes
2 answers
86k views

How can I implement a touch-sensitive, responsive, sortable list supporting drag & drop for Bootstrap?

I have a <ul> list that I want to make sortable (drag & drop). How can I get it to work with Bootstrap 3 in modern browsers and touch devices? I'm trying to use jqueryui-sortable combined ...
brk's user avatar
  • 631

1
2 3 4 5
127