Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6025021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:14:28+00:00 2026-05-23T04:14:28+00:00

I have this script for my CSS Vertical Menu: //Nested Side Bar Menu (Mar

  • 0

I have this script for my CSS Vertical Menu:

//Nested Side Bar Menu (Mar 20th, 09)
//By Dynamic Drive: http://www.dynamicdrive.com/style/

var menuids=["sidebarmenu1"] //Enter id(s) of each Side Bar Menu's main UL, separated by commas

function initsidebarmenu(){
for (var i=0; i<menuids.length; i++){
  var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul")
    for (var t=0; t<ultags.length; t++){
    ultags[t].parentNode.getElementsByTagName("a")[0].className+=" subfolderstyle"
  if (ultags[t].parentNode.parentNode.id==menuids[i]) //if this is a first level submenu
   ultags[t].style.left=ultags[t].parentNode.offsetWidth+"px" //dynamically position first level submenus to be width of main menu item
  else //else if this is a sub level submenu (ul)
    ultags[t].style.left=ultags[t-1].getElementsByTagName("a")[0].offsetWidth+"px" //position menu to the right of menu item that activated it
    ultags[t].parentNode.onmouseover=function(){
    this.getElementsByTagName("ul")[0].style.display="block"
    }
    ultags[t].parentNode.onmouseout=function(){
    this.getElementsByTagName("ul")[0].style.display="none"
    }
    }
  for (var t=ultags.length-1; t>-1; t--){ //loop through all sub menus again, and use "display:none" to hide menus (to prevent possible page scrollbars
  ultags[t].style.visibility="visible"
  ultags[t].style.display="none"
  }
  }
}

if (window.addEventListener)
window.addEventListener("load", initsidebarmenu, false)
else if (window.attachEvent)
window.attachEvent("onload", initsidebarmenu)

Where can I use timeout() to delay de menu from hiding right away?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T04:14:29+00:00Added an answer on May 23, 2026 at 4:14 am

    Script:

    //Nested Side Bar Menu (Mar 20th, 09)
    //By Dynamic Drive: http://www.dynamicdrive.com/style/
    
    var menuids=["sidebarmenu1"] //Enter id(s) of each Side Bar Menu's main UL, separated by commas
    var defaultDelay = 0; //ms
    
    function initsidebarmenu(){
        for (var i=0; i<menuids.length; i++){
            var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul");
            for (var t=0; t<ultags.length; t++){
                ultags[t].parentNode.getElementsByTagName("a")[0].className+=" subfolderstyle";
                if (ultags[t].parentNode.parentNode.id==menuids[i]){ //if this is a first level submenu
                    ultags[t].style.left=ultags[t].parentNode.offsetWidth+"px"; //dynamically position first level submenus to be width of main menu item
                } else{ //else if this is a sub level submenu (ul)
                    ultags[t].style.left=ultags[t-1].getElementsByTagName("a")[0].offsetWidth+"px"; //position menu to the right of menu item that activated it
                }
                ultags[t].parentNode.onmouseover=function(){
                    var elem = this.getElementsByTagName("ul")[0];
                    if (elem){
                        if (elem.timer){
                            clearTimeout(elem.timer);
                        }
                        elem.timer=0;
                        elem.style.display="block";
                    }
                }
                ultags[t].parentNode.onmouseout=function(){
                    var elem = this.getElementsByTagName("ul")[0];
                    if (elem){
                        var delay = defaultDelay;
                        if (elem.parentNode && elem.parentNode.parentNode && elem.parentNode.parentNode.className){
                            var match = /submenu-delay-([0-9]*)/i.exec(elem.parentNode.parentNode.className);
                            delay = (match && (match.length > 1)) ? match[1] : defaultDelay;
                        }
                        elem.timer=setTimeout(function(){
                            elem.style.display="none";
                        }, delay);
                    }
                };
            }
            for (var t=ultags.length-1; t>-1; t--){ //loop through all sub menus again, and use "display:none" to hide menus (to prevent possible page scrollbars
            ultags[t].style.visibility="visible"
            ultags[t].style.display="none"
            }
        }
    }
    
        if (window.addEventListener)
        window.addEventListener("load", initsidebarmenu, false)
        else if (window.attachEvent)
        window.attachEvent("onload", initsidebarmenu)
    

    HTML:

    <div class="sidebarmenu">
    <ul id="sidebarmenu1" class='submenu-delay-1000'>
    <li><a href="#">Item 1</a></li>
    <li><a href="#">Item 2</a></li>
    <li><a href="#">Folder 1</a>
      <ul>
      <li><a href="#">Sub Item 1.1</a></li>
      <li><a href="#">Sub Item 1.2</a></li>
      </ul>
    </li>
    <li><a href="#">Item 3</a></li>
    
    <li><a href="#">Folder 2</a>
      <ul>
      <li><a href="#">Sub Item 2.1</a></li>
      <li><a href="#">Folder 2.1</a>
        <ul>
        <li><a href="#">Folder 2.1.1</a>
            <ul class='submenu-delay-5000'>
            <li><a href="#">Sub Item 2.1.1.1</a></li>
            <li><a href="#">Sub Item 2.1.1.2</a></li>
            <li><a href="#">Folder 2.1.1.3</a>]
                <ul >
                <li><a href="#">Sub Item 2.1.1.3.1</a></li>
                <li><a href="#">Sub Item 2.1.1.3.2</a></li>
                </ul>
            </li>
            </ul>
        </li>
        <li><a href="#">Sub Item 2.1.2</a></li>
        <li><a href="#">Sub Item 2.1.3</a></li>
        <li><a href="#">Sub Item 2.1.4</a></li>
        </ul>
      </li>
    </ul>
    </li>
    <li><a href="#">Item 4</a></li>
    </ul>
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a website scrolling horizontally using this script: http://tympanus.net/Tutorials/WebsiteScrolling/index.html Sometimes with this build
I wrote this script awhile back and have modified it to use css sprites
I have this script: select name,create_date,modify_date from sys.procedures order by modify_date desc I can
I have this script which basically toggles a bgColor class on and off so
i have this script $content = string if(!isset($_GET['page'])){ $page = 1; } else{ $page
I have this script to generate an XML file for an RSS feed. Works
I have this script and when i try to run it, it just says
I have this script at the moment, which changes an image when a thumbnail
I have this script loaded on a page: (function() { window.alert('bookmarklet started'); function AjaxSuccess(data,
I have this script <?php if (!empty($_FILES)) { $tempFile = $_FILES['Filedata']['tmp_name']; $targetPath = dirname(__FILE__)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.