website with touch mimicking mouse
- Started
- Last post
- 3 Responses
- fadein11
Quick question. I am building a site that uses a lot of layers that move depending on mouse position.
For mobile I need the same to happen depending on where the user is touching the mobile/tablet screen - so basically touch mimics mouse. The user would need to swipe all over the screen the same way a mouse moves around the screen.
Is there a quick way of doing this?
I am aware of jQuery Touch etc. but they seem a bit overblown for this simple task.
Any ideas please?
Thanks.
- moldero1
bump for fadein11
- PonyBoy0
you can just use simple Javascript 'touch events' (event listeners) and 'touch objects' (attributes that provide x, y coordinates etc etc)... all you need to do is write a couple of functions where the event trigger provides the value of an object...
this may shed some light:
http://www.javascriptkit.com/jav…
https://www.w3.org/TR/touch-even…- yep thanks - I can do it with jQuery Touch as mentioned in my post - just wondered if there was a less convoluted method?fadein11
- demos don't work with mouse - need to work both with mouse and touch.fadein11
- can't assign mouse events too? I figured JS is the 'thinnest' route (just accessing built-in events- wasn't sure if you were avoiding loading jquery altogether)PonyBoy
- monNom0
Check out hammerjs