473,322 Members | 1,501 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

jQuery nav not responding

162 100+
I'm building a navigation that is built heavily on jQuery. I have it working as needed except that when mousing over links to quickly it spikes the processor and the navigation hangs. By hangs i mean it stops working and even the links will not show rollover states. I thought it was just a matter of adding a stop() but this changed nothing. Any ideas?

Here it is online http://sb.cesarvillaca.com/nav/nav.html

The code is below.

Expand|Select|Wrap|Line Numbers
  1.  
  2. <div id="ProductsNav-ov" style="display:none;"></div>
  3.  
  4. <div id="main-nav">
  5.  
  6. <ul>
  7.     <li class="mainnav-click" id="ProductsNav">PRODUCTS</li>
  8. </ul>
  9.  
  10. <script type="text/javascript">
  11. <!--
  12. $(function() {
  13.  
  14.     $('.mainnav-click').mouseenter(function() { 
  15.         //alert($(this).attr('id'));
  16.         buildNav($(this).attr('id'));
  17.     });
  18.  
  19. });
  20.  
  21. function buildNav(nav,sub){
  22.  
  23.     //alert(nav);
  24.  
  25.     var Shredders = new Array({
  26.         Deskside: '',
  27.         Professional: '',
  28.         Commercial: '',
  29.         Government_Approved: '',
  30.         Supplies: ''
  31.     });
  32.  
  33.     var Records_Storage = new Array({
  34.         Storage_Drawers: '', 
  35.         Storage_Boxes: '',
  36.         Earth_Series: '',
  37.         Classroom_Organization: '',
  38.         Moving_Boxes: '',
  39.         Magazine_Holders: '',
  40.         Sorters: ''
  41.     });
  42.  
  43.     var Workspace_Ergonomics = new Array({
  44.         Keyboard_Trays_and_Drawers: '', 
  45.         Palm_and_Wrist_Supports: '',
  46.         Monitor_Supports: '',
  47.         Back_Supports: '',
  48.         Foot_Supports: '',
  49.         Copyholders: '',
  50.         Monitor_Filters: '',
  51.         Machine_Stands: ''
  52.     });
  53.  
  54.     var Workspace_Organization = new Array({
  55.         Desk_Organizers: '', 
  56.         Cubicle_Organizers: '',
  57.         Literature_Organizers: '',
  58.         Mail_Carts: ''
  59.     });
  60.  
  61.     var Computer_Accessories = new Array({
  62.         Keyboards_and_Mice: '', 
  63.         Mouse_Pads: '',
  64.         Cleaning_Supplies: '',
  65.         Power_Protection: '',
  66.         Keyguards: ''
  67.     });
  68.  
  69.     var CD_DVD_Products = new Array({
  70.         Jewel_Cases_and_Inserts: '', 
  71.         Desktop: ''
  72.     });
  73.  
  74.     var Binding_Machines = new Array({
  75.         Plastic_Comb: '', 
  76.         Wire: '',
  77.         Thermal: '',
  78.         Supplies: ''
  79.     });
  80.  
  81.     var Laminating_Machines = new Array({
  82.         Personal: '', 
  83.         General_Office: '',
  84.         Supplies: ''
  85.     });
  86.  
  87.     var Cutters_and_Trimmers  = new Array({
  88.         Cutters: '',
  89.         Rotary_Trimmers: '',
  90.         Supplies: ''
  91.     });
  92.  
  93.     var Mobile_Accessories  = new Array({
  94.         Mobile_Accessories: ''
  95.     });
  96.  
  97.     var Refurbished_Shredders  = new Array({
  98.         Refurbished_Shredders: ''
  99.     });
  100.  
  101.     var Where_To_Buy  = new Array({
  102.         Where_To_Buy: ''
  103.     });
  104.  
  105.     var ProductsNav = {
  106.         "Shredders": Shredders, 
  107.         "Records_Storage": Records_Storage, 
  108.         "Workspace_Ergonomics": Workspace_Ergonomics, 
  109.         "Workspace_Organization": Workspace_Organization, 
  110.         "Computer_Accessories": Computer_Accessories, 
  111.         "CD_DVD_Products": CD_DVD_Products, 
  112.         "Binding_Machines": Binding_Machines, 
  113.         "Laminating_Machines": Laminating_Machines, 
  114.         "Cutters_and_Trimmers": Cutters_and_Trimmers, 
  115.         "Mobile_Accessories": Mobile_Accessories, 
  116.         "Refurbished_Shredders": Refurbished_Shredders, 
  117.         "Where_To_Buy": Where_To_Buy 
  118.     };
  119.  
  120.     if (sub==undefined) {
  121.  
  122.         var navPOP='';
  123.         navPOP+=
  124.  
  125.         '<div id="drop-down-container">'+
  126.             '<div id="mainnav-title-ov">'+
  127.                 '<div class="sprite main-nav-left lfloat"></div>'+
  128.                 '<div class="main-nav-center auto-width">PRODUCTS</div>'+
  129.                 '<div class="sprite main-nav-right lfloat"></div>'+
  130.                 '<br class="clear">'+
  131.             '</div>'+
  132.             '<div id="drop-down" class="auto-width">'+
  133.                 '<div id="mainnav-container" class="dots">'+
  134.                     '<ul id="mainnav">';
  135.  
  136.                     var navname = "";
  137.                     $.each(eval(nav), function(mainNav, mainNavobject) {
  138.  
  139.                         $.each(mainNavobject, function(i, subNavobject) {
  140.  
  141.                             $.each(subNavobject, function(property, value) {
  142.  
  143.                                 if (navname != mainNav) {
  144.  
  145.                                     navname = mainNav;
  146.  
  147.                                     navPOP+= '<li><a href="' + value + '" class="subnav-click" id="' + mainNav + '">'+str_replace("_"," ",mainNav)+'</a></li>';
  148.  
  149.                                 }
  150.  
  151.                             });
  152.  
  153.                         });
  154.  
  155.                     });
  156.  
  157.                     navPOP+= 
  158.  
  159.                     '</ul>'+
  160.                 '</div>'+
  161.                 '<div id="drop-down-sub"></div>'+
  162.                 '<br class="clear">'+
  163.             '</div>'+
  164.         '</div>';
  165.  
  166.         var whatmenu = nav+'-ov';
  167.  
  168.         $('#'+whatmenu).html(navPOP);
  169.         $('#mainnav-container').removeClass('dots');
  170.  
  171.         $('#'+whatmenu).position({ my: "left top", at: "left top"});
  172.  
  173.         $('#'+whatmenu).show();
  174.  
  175.     }else{
  176.  
  177.         //$("#drop-down-sub").stop();
  178.  
  179.         $('#drop-down-sub').empty();
  180.  
  181.         var navPOPsub='';
  182.         navPOPsub+= '<ul id="subnav">';
  183.  
  184.         $.each(eval(nav), function(mainNav, subNavobject) {
  185.  
  186.             $.each(subNavobject, function(property, value) {
  187.  
  188.                 navPOPsub+= '<li><a href="' + value + '">'+str_replace("_"," ",property)+'</a></li>';
  189.  
  190.             });
  191.  
  192.         });
  193.  
  194.         navPOPsub+= '</ul>';
  195.  
  196.         $('#mainnav-container').addClass('dots');
  197.         $('#drop-down-sub').html(navPOPsub);
  198.         $('#drop-down-sub').show();
  199.     }
  200.  
  201.     $('.subnav-click').mouseover(function() { 
  202.         buildNav($(this).attr('id'),1);
  203.     });
  204.  
  205.     $('#drop-down-container').mouseleave(function() { 
  206.         $('#ProductsNav-ov').hide();
  207.     });
  208.  
  209. }
  210. //-->
  211. </script>
  212.  
  213. </div>
  214.  
  215. </div>
  216.  
Mar 11 '11 #1
0 1064

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Gale | last post by:
I'm working on something in jQuery with XPath What I want to do is: if checkbox is checked, set background color od label that contain input(checkbox) to red I have this code:...
5
by: ziobudda | last post by:
Hi, I want ask you if, for a web portal/application, is better prototype or Jquery? I don't want to innesc some type of flame, but after the announce that drupal use JQuery and that the new...
1
by: DuaneMoraes | last post by:
A new book on jQuery, the powerful JavaScript library, has been announced by Packt In Learning jQuery, Karl Swedberg and Jonathan Chaffer, creators of the popular jQuery learning resource...
1
by: mikeh3275 | last post by:
I'm new to developing in jQuery, so I'm probably doing this wrong. I'm loading a form into a modal dialog box and I'm trying to assign a click event to the button in the form, but I can't seem to...
20
by: Aaron Gray | last post by:
There does not seem too be anyway to test if two jQuery references are the same element. Given :- ... <div id="1"></div .... Then :- alert( $("#1") == $("#1"))
26
by: RobG | last post by:
Do some of the regulars here need to re-think their (sometimes strident) opposition to libraries? Both Microsoft and Nokia have announced support for jQuery. It seems to have gained quite a bit...
2
by: souporpower | last post by:
Hi All I am trying to print some HTML using JQUERY. I am posting the code. I don't see the alert. It seems as though the function is not registered when the document is loaded. Can someone...
53
by: souporpower | last post by:
Hello All I am trying to activate a link using Jquery. Here is my code; <html> <head> <script type="text/javascript" src="../../resources/js/ jquery-1.2.6.js"</script> <script...
5
by: jrod11 | last post by:
hi, I found a jquery html table sorting code i have implemented. I am trying to figure out how to edit how many colums there are, but every time i remove code that I think controls how many colums...
0
by: amskape | last post by:
hi Friends, I need to Upload some files in a Listing , by clicking corresponding Upload link, then a popup window will come with Browse option as Shown in attachment File. My actual need is...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.