1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Change popup menu delay

Javascript edit to change delay for the popup menu when mousing over a nav tab or other menu.

  1. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Jake Bunce submitted a new resource:

    Change popup menu delay (version 1.x) - Javascript edit to change delay for the popup menu when mousing over a nav tab or other menu.

    Read more about this resource...
     
    rafass likes this.
  2. bogus

    bogus Guest

    Thanks for that. Nice feature ;)
    I see you know js so i would like to ask if its possible to add something that will close the popup after mouse is leaving the popup menu.
    Right now you need to click somewhere else to get the menu popup closed?!
    Thanks a lot
     
    doibay likes this.
  3. CyberAP

    CyberAP Well-Known Member

    Super useful. Thanks a lot for that!
     
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Not really. I only have a fumbling knowledge of js right now. I am learning but I don't know how to do this off hand. Probably need the onmouseout event, though I'm not sure how to tie that into the existing js.
     
  5. CyberAP

    CyberAP Well-Known Member

    Jake Bunce likes this.
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Cool. I didn't realize you can override just one function in that object. I assumed you had to redefine the whole object. It is a big function to redefine but that solution certainly works. Both solutions have problems with upgrades, but yours not as much as mine.
     
  7. CyberAP

    CyberAP Well-Known Member

    It was done because I wanted to include this right in the style, so user doesn't have to edit any xenforo files.
     
  8. QenTox

    QenTox Well-Known Member

    I changed that to 20 and that just seems the right value for me. Thanks Jake for this useful tip!
     
  9. adwade

    adwade Active Member

    Is this Code Modification still valid, with XF 1.5+? I ask because I tried revising it (i.e. up to 5000) and couldn't tell any difference. :confused:
     
  10. rafass

    rafass Well-Known Member

    Works perfectly. 55 is the perfect speed to me :sneaky:
     
  11. adwade

    adwade Active Member

    Well I was asking since it doesn't seem to work for me and I noticed this depreciation statement in the xenforo.js file…
    Code:
    A=function(t){return"string"!=typeof t||e.event.special.hover?t:(H.test(t)&&r("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'"),t&&t.replace(H,"mouseenter$1 mouseleave$1"))};e.event.props&&"attrChange"!
    So I was wondering if this code (just under the hoverIntent r5 section of the file) was what now controlled the delay instead…?
    Code:
    (function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY;};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev]);}
     
    Last edited: Apr 23, 2016
  12. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    It should work. Be sure to do a hard refresh of the page (or restart your browser) to get the latest js after applying the modification.
     

Share This Page