I'm working on a jQuery plugin that encapsulates this intelligently. I'm new to jQuery plugins, though, so it's a bit of a trial-and-error type thing...
Thanks! Jon Brisibn http://jbrisbin.com On May 22, 2008, at 4:20 AM, Matt Sephton wrote: > > Nice work > > On Wed, May 21, 2008 at 4:30 PM, Jon Brisbin <[EMAIL PROTECTED]> > wrote: >> >> I don't know if this is documented anywhere, but I'm working on an >> app >> where I'd like to capture the double-tap at max zoom to re-center the >> page using window.scrollTo. While there isn't a double-tap event, I'm >> able to figure out that a double-tap has happened because the >> onscroll >> event fires whenever the screen is tapped, whether the user actually >> scrolls the page or not. Checking the time between the two firings of >> the onscroll event will tell me if the user has double-tapped within >> the timeout period I set. Something like: >> >> var inDoubleTap = false; >> var doubleTapTimer = false; >> window.onscroll = function(){ >> if(!doubleTapTimer){ >> doubleTapTimer = setTimeout(function(){ inDoubleTap = false; }, >> 500); >> } >> if(!inDoubleTap){ >> inDoubleTap = true; >> }else{ >> // call function to run if double-tap >> myFunction(); >> inDoubleTap = false; >> } >> } >> >> I can add a check to the orientation as well to limit this double-tap >> capture to landscape mode. >> >> >> Thanks! >> >> Jon Brisibn >> http://jbrisbin.com >> >> >>> >> > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "iPhoneWebDev" 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/iphonewebdev?hl=en -~----------~----~----~----~------~----~------~--~---
