Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delay for events on Touch Devices #33

Closed
tylerhowarth opened this issue Jun 4, 2013 · 6 comments
Closed

Delay for events on Touch Devices #33

tylerhowarth opened this issue Jun 4, 2013 · 6 comments

Comments

@tylerhowarth
Copy link

When testing on a computer, events are extremely responsive and fire animations immediately. When I test on a touch device the animations are delayed by a few hundred milliseconds. Is there a workaround for this?

PSD.object.on("click", function() {...});
@tylerhowarth
Copy link
Author

According to Google

...mobile browsers will wait approximately 300ms from the time that you tap the button to fire the click event. The reason for this is that the browser is waiting to see if you are actually performing a double tap.

My temporary solution is to include FastClick in to my index.html

Does anyone else think we should include something like FastClick in Framer?

@tylerhowarth
Copy link
Author

Anyone have thoughts on this?

@joshpuckett
Copy link

Hey Tyler!

So, if you are building something exclusively for mobile devices, you can use the touchStart event, which fires instantly, as opposed to the click event. If you want both click and touch events, but want them to fire immediately on their respective platforms, you'll have to build in an event abstraction. Here's the general idea of how that would work:

if (touchDevice()) {

Events.TouchStart = "touchstart";
Events.TouchEnd = "touchend";
Events.TouchMove = "touchmove";

} else {

Events.TouchStart = "mousedown";
Events.TouchEnd = "mouseup";
Events.TouchMove = "mousemove";

}

view.on(Events.TouchStart, function() {

return console.log("Touch started");

});

@tylerhowarth
Copy link
Author

@joshpuckett thanks! I will definitely try that out example out, because I end up using framer on web & mobile.

@koenbok
Copy link
Owner

koenbok commented Jun 17, 2013

Also, I already built these in (but did not publicly document them yet)
under the global Events object. You can check out events.coffee for more
info.

On Monday, June 17, 2013, Tyler Howarth wrote:

@joshpuckett https://github.com/joshpuckett thanks! I will definitely
try that out example out, because I end up using framer on web & mobile.


Reply to this email directly or view it on GitHubhttps://github.com//issues/33#issuecomment-19519291
.

@koenbok
Copy link
Owner

koenbok commented May 15, 2014

Fixed with Events.Click

@koenbok koenbok closed this as completed May 15, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants