SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Sep 2009
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    DisplayDIV Delay

    Yes, it's another TimeOut/Delay question

    I'm trying to add a delay to the OnMouseOut DisplayDIV function.
    The problem is that a QuickTime <object> is rendering on top of the menu in some browsers. So I'm doing Show/Hide when the drop-down is activated.

    I want to add the delay to DisplayDIV because the menu has a 800ms delay OnMouseout, and I want to keep that.

    Here is the example...
    newinelabs.com/development/js_superfish_problem/index.htm

    You may or may not notice the issue. I see it in Mac FF, but not Safari. I haven't tested it in other browsers yet.

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,526
    Mentioned
    83 Post(s)
    Tagged
    3 Thread(s)
    Typically you would give the mouseout function a callback, so that once the delayed behaviour has occurred, it can finish by running the callback.

    That callback you would use to toggle the show/hide of the quicktime object.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Member
    Join Date
    Sep 2009
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think I kinda' follow what you are saying, it seems like a 'best practice' to do it in the way you describe.
    Any chance you could be more specific?

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,526
    Mentioned
    83 Post(s)
    Tagged
    3 Thread(s)
    Let's start with the jQuery hover event, where you can specify a handlerin and a handlerout function.

    The handlerout function normally only takes an event object, but you can create a callback variable inside the function, and pass that to the function that does the delay.

    Even if you cannot get a callback going, you should still be able to move the displayDiv stuff to the section of code that runs after the delay.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •