On Fri, Feb 13, 2009 at 8:17 PM, jason kuhn <[email protected]> wrote:
> > Hi all, > > I've came up with a solution to allow most of the UI widgets that > depend on mouse events to work on the iPhone. It's a variation of a > script that Ross Boucher (http://rossboucher.com/2008/08/19/iphone- > touch-events-in-javascript/<http://rossboucher.com/2008/08/19/iphone-%0Atouch-events-in-javascript/>) > started, but meant for use with jQuery. > > I have set up a demo of what works and doesn't work (yet). I figured > you guys might like to check it out! > > It's a little temperamental, but it's a start. I've noticed that on an > actual iPhone/Touch it's slow with animating and dragging, but on the > Simulator, it works great. > > demo: http://jasonkuhn.net/mobile/jqui/ > plugin: http://jasonkuhn.net/mobile/jqui/js/jquery.iphoneui.js > > all you need to do is call .addTouch() on whatever element you want to > use touch events to simulate the mouse events. > > ex: $('.drag').draggable({helper: 'clone'}).addTouch(); > > Maybe this will be helpful for some iPhone specific UIs... > > Any input or feedback or improvements would be great! > > Enjoy! > Jason Hey Jason, great work! Very cool timing, in fact, by pure coincidence I developed a patch for the next version of jQuery UI (after 1.7) that works almost the same. You'll find it here: http://dev.jqueryui.com/ticket/4143 There's one small but important difference: Instead of delegating or forwarding the events, it simply binds the touch* events instead as replacement. Only the droppable plugin needed a small fix, because it was checking for event.type == 'mousedown'. I've noticed the same issues you had - resizable doesn't work since it uses mouseover events for handle detection. That needs to be refactored anyway for the next version. Selectable clicks don't work, as you also noticed, but I didn't investigate the cause yet. There are some performance issues on the actual device though right now. They're mainly related to the offset function (iPhone doesn't support getBoundingClientRect), and more importantly, the triggering of custom events. I'll work on both. Jason, feel free to try out the patch, and provide any solutions you find. Any help is greatly appreciated. Thanks, Paul > > > > > -- Paul Bakaus UI Architect -- http://paulbakaus.com http://www.linkedin.com/in/paulbakaus --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery UI" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/jquery-ui?hl=en -~----------~----~----~----~------~----~------~--~---
