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

Do click events work on iPad? #132

Open
jim-at-miramontes opened this issue Feb 28, 2013 · 3 comments
Open

Do click events work on iPad? #132

jim-at-miramontes opened this issue Feb 28, 2013 · 3 comments

Comments

@jim-at-miramontes
Copy link

I'm just getting started with gridster (very pleased!), and the only problem I'm having is that I can't get click events on gridster items to work on an iPad. Dragging items works fine, and in the same way that it does in a browser window. But click events, set up via something like:

$('.gridster ul li').click(function () {
    alert('hi from li.click handler');
    // stuff happens
});

work fine in a browser but give me nothing on an iPad -- the alert never fires. Is anything known about this? Thanks!

@jim-at-miramontes
Copy link
Author

Of course, as soon as I posted this, I made some progress...

Although the state of the click event in all of this is still murky to me, iOS will throw other touch-related events in response to taps; in particular, touchstart, touchend, touchmove, and touchcancel. These can be combined in various ways to create multi-touch events, but, in the meantime, touchend seems to be a pretty good stand-in for click: I made a copy of my click() handler and assigned it to touchend, and it mostly worked. There were some issues around the touchend handler wanting to do stuff when a drag was being done, but a bit of "is a drag underway?" semaphore code got me past it (cf. http://stackoverflow.com/questions/14301026/gridster-do-not-invoke-the-click-action-for-the-div/14394726#14394726).

So I think I'm in reasonable shape, although still uncertain about the status of click. There's a good discussion of iOS events as it pertains to all of this at http://developer.apple.com/library/safari/#documentation/appleapplications/reference/safariwebcontent/HandlingEvents/HandlingEvents.html . It certainly suggests that an iOS tap event should cause a click event to be sent, so there may still be some things that could be done with gridster.

Meanwhile, thanks again for gridstar in the first place!

@gotwig
Copy link

gotwig commented Mar 13, 2013

Thank you really much for that info. I also had problems with iOS devices.

I am looking forward to an upstream solution.

@jim-at-miramontes
Copy link
Author

great!

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

2 participants