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 6074651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:24:22+00:00 2026-05-23T10:24:22+00:00

I’m making a menu with a lot of functionality. I have to implement it

  • 0

I’m making a menu with a lot of functionality. I have to implement it towards other developers system, so I haven’t been able to successfully make a jsfiddle for it. However, what happens is that if I leave it for a few minutes on the page, and go back to activate it, the browser will freeze for a second or more, perhaps even causing a “This script is causing the page to freeze etc.”.

I think it’s related to my timers. So I was hoping someone could take a look at the functions that run with timers, as my other functions are triggered by mouseevents, and see if they make sense. I know there’s a lot of code, but if you specifically look for the timers I think someone with more experience than me can get the jist of it. I’m gonna have to buckle down and see if I get a fiddle to work if not.

The button that triggers the delay itself is the ul.downArrow inside the second timer in the code.

/* Check if submenu should be closed */
var timer;
$jq('#subNavigationContainer').hover(
    function(){
        clearTimeout(timer);
    },
    function(){
        var checkNavVariation = $jq('#subNavigationContainer').hasClass('small');
        timer=setTimeout(function () {
            if(checkNavVariation == false){
                $jq('#subNavigationContainer').animate({
                    height: ['50px', 'easeOutSine']
                }, 600, 'linear');
                var testLevel = $jq('#navigationContainer ul li.pathed').size();
                $jq('#subNavigationContainer ul,#subNavigationContainer #subMenuDescription').fadeOut('fast');  
                setTimeout(function () {
                    /* Indicate we want breadcrumb to open */
                    $jq('#subNavigationContainer').addClass('isClosed');        
                    if(testLevel < 1) {
                        $jq('#navigationContainer ul li').removeClass('selected');      
                    }
                    $jq('#navigationContainer ul li').children('.selArrow').remove();   
                }, 600);
            }
        }, 1500);
    }
);

setTimeout(function(){
    $jq('ul.downArrow').click(function() {
        loadMenu();
    }); 
    setTimeout(arguments.callee,1200);
},1200)

/* Automatic check for breadcrumb */
var counter = 0;
setTimeout(function(counter){       
    var subNavVisible = $jq('#subNavigationContainer').css('display');
    var subNavClosed = $jq('#subNavigationContainer').hasClass('isClosed');

    if(subNavClosed == true) {
        if(counter == 0) {
            $jq('#subNavWrapper ul').remove();
            $jq('#subNavWrapper div.subMenuDescription').remove();  
        } else {
            $jq('#subNavWrapper ul.downArrow').remove();
            $jq('#subNavWrapper div.subMenuDescription').remove();  
            $jq('#subNavWrapper ul.levelTwo').remove();     
            $jq('#subNavWrapper ul.levelThree').remove();   
            $jq('#subNavWrapper ul.levelFour').remove();            

        }
        $jq('#subMenuDescription').remove();
        $jq('#navigationContainer ul.levelOne').children('li.pathed').each(function() {
            /* Mark the top menu */
            $jq(this).siblings('li').removeClass('hover').removeClass('selected');
            $jq(this).siblings('li').children('.selArrow').remove();
            $jq(this).addClass('selected').addClass('hover');
            var liWidth = $jq(this).width();
            liWidth = (liWidth / 2) - 15;
            $jq(this).append('<div class="selArrow" style="margin-left: '+liWidth+'px"></div>');
            var highestHeight = 50;
            $jq(this).children('ul').clone().appendTo('#subNavWrapper').addClass('cloned');             
            $jq(this).children('ul').children('li.selected').children('ul').clone().appendTo('#subNavWrapper').addClass('cloned');
            $jq(this).children('ul').children('li.selected').children('ul').children('li.selected').children('ul').clone().appendTo('#subNavWrapper').addClass('cloned');
            var hasLevel = $jq('#subNavWrapper ul.levelThree li.pathed').size();

            $jq('#subNavWrapper ul').css('display','none');
            /* Check for grey submenu area visible or not */
            var subNavVisible = $jq('#subNavigationContainer').css('display');
            if(subNavVisible != "block") {
                $jq('#subNavigationContainer').css('height','0px');
                $jq('#subNavigationContainer').css('display','block');
                $jq('#subNavigationContainer').addClass('small');
                $jq('#subNavigationContainer').animate({
                    height: [highestHeight+'px', 'easeOutSine']
                  }, 300, 'linear');
            } else if(subNavVisible == "block") {
                $jq('#subNavigationContainer').animate({
                    height: [highestHeight+'px', 'easeOutSine']
                  }, 300, 'linear');
            }
            $jq('#subNavWrapper ul').css('height','2px').css('width','200px').css('display','block');
            $jq('#subNavWrapper ul li').css('display','none');
            $jq('#subNavWrapper ul li.pathed').addClass('breadcrumb');
            $jq('#subNavWrapper ul li.pathed').fadeIn('fast');
            $jq('#subNavWrapper ul li.pathed:last').parent('ul').after('<ul class="downArrow"><li><img src="http://dev.ghostwriter.no/demo/altibox/images/arrow-down.gif" alt="Ekspander" /><span>Utvid meny</span></li></ul>');
            $jq('#subNavWrapper ul').animate({
                height: ['21px', 'easeOutSine']
            }, 100, 'linear');
            counter++;
            $jq('#subNavigationContainer').removeClass('isClosed');
        });
    } else if(subNavClosed == false) {

    }
    setTimeout(arguments.callee,750) 
},750)
  • 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-23T10:24:22+00:00Added an answer on May 23, 2026 at 10:24 am

    there are timers checking if the menu
    is open, if not it will open a
    breadcrumb like area

    It’s better to handle a moment when menu is closing and trigger showing your breadcrumb like area. No timeouts required.

    there’s a timer checking for a click on an arrow in the breadcrumb, that will open the menu again

    Just handle click on an arrow in the breadcrumb and open menu in handler! No timeouts required here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
I have just tried to save a simple *.rtf file with some websites and
I have a French site that I want to parse, but am running into
I'm making a simple page using Google Maps API 3. My first. One marker
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a bunch of posts stored in text files formatted in yaml/textile (from
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I am trying to loop through a bunch of documents I have to put
I have some data like this: 1 2 3 4 5 9 2 6

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.