Tap, Pan for a map & fixed headers - event conflict

Posted by kaiser on Stack Overflow See other posts from Stack Overflow or by kaiser
Published on 2012-02-03T18:08:03Z Indexed on 2012/04/09 5:29 UTC
Read the original article Hit count: 285

Filed under:
|
|

I'm currently developing a small WebApp that makes use of

Now I encountered a conflict that appears on touch enabled devices as well as on desktop/mouse controlled "click" events: When I "tap" or "click" the map to actually "pan" it, then my header/footer toggles it's visibility. As I want to keep the toggle behaviour, I can't simply deactivate it, but showing/hiding the header/footer on every "pan" of the map is odd. After thinking some time about it, I think I got a concept that should work:

Question: How I can I add a delay to the visibility toggle for the header/footer? So when I don't release the finger/mouse after XYms, the header/footer doesn't show/hide?

Example:

jQuery( '#map_page' ).live( 
    "pageinit"
    ,function() 
    {
        // Att.: pseudo code
        if ( $.mobile.taphold )
            don't toggle fixed
        if ( mousedown > XYms )
            don't toggle fixed
    }
);

Thanks!

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about google-maps