Pretraži podršku

Izbjegni prevare podrške. Nikad te nećemo tražiti da nas nazoveš, da nam pošalješ telefonski broj ili da podijeliš osobne podatke. Prijavi sumnjive radnje pomoću opcije „Prijavi zlouporabu”.

Saznaj više

Javascript Error: My dropdown menu sub item links dont work in Firefox. But they work in Safari and IE.

  • 4 odgovora
  • 1 ima ovaj problem
  • 7 prikaza
  • Posljednji odgovor od cillacil

more options

I am building a site and i have a javascript drop down menu. The links work on the main button. But when i click on any of the sub menu items under any of the button, it takes me to the webpage that the main button is pointing to. The submenu buttons work in Safari and IE.

I am building a site and i have a javascript drop down menu. The links work on the main button. But when i click on any of the sub menu items under any of the button, it takes me to the webpage that the main button is pointing to. The submenu buttons work in Safari and IE.

Izabrano rješenje

I copied your code under "More system details" to a local file and opened it in Firefox. Alle link work like they should. I can not do more without having a url for a site. How do you expect us to test this ?

Pročitaj ovaj odgovor u kontekstu 👍 0

Svi odgovori (4)

more options

The html that is posted on the forum seems to be working fine for me. The problem is probably in the javascript or css.

more options

What did you do to trouble shoot it?

more options

Odabrano rješenje

I copied your code under "More system details" to a local file and opened it in Firefox. Alle link work like they should. I can not do more without having a url for a site. How do you expect us to test this ?

more options

The site is not live yet. I am testing it on my local machine. HERE IS THE JAVASCRIPT MENUSM.JS:


jQuery(document).ready(function($){

   // menu smothness
   $('.menusm li').click(function() {
     window.location = $(this).find('a:first').attr('href');
   });
   var dropdown_level = 0;
   $('.menusm li ul').parent().find('a:first').addClass('have_submenu');
   $('.menusm').children('li').children('a').addClass('top_level');
   $('.menusm').children('li').children('a').removeClass('have_submenu');
   $('.menusm li').hover(function(){
     if(dropdown_level == 0){
       $('.menusm').find('a').removeClass('have_submenu_hover');
       $(this).addClass('li_hover_main');
       $(this).children('a').addClass('a_hover_main');
       $('.menusm ul').parent().find('a:first').addClass('have_submenu');
       $('.menusm').children('li').children('a').addClass('top_level');
       $('.menusm').children('li').children('a').removeClass('have_submenu');
     }
     $(this).find('ul:first').stop(true,true).slideDown(200).show();
     $(this).find('a:first').addClass('have_submenu_hover');
     $('.menusm').children('li').children('a').removeClass('have_submenu_hover');
     dropdown_level++;
   },function(){
     $(this).find('ul:first').stop(true,true).slideUp(0);
     $(this).find('a:first').removeClass('have_submenu_hover');
     dropdown_level--;
     if(dropdown_level == 0){
       $(this).removeClass('li_hover_main');
       $(this).children('a').removeClass('a_hover_main');
      }
   });

// END of menu smothness

});


HERE IS THE CSS MENUSM.CSS:

@charset "utf-8"; /* CSS Document */

ul.menusm { font-size:14px; line-height:14px;}

/* DESIGN TOPNAV (mainmenu) */ .topnav { margin:0; padding:44px 0 0; float:right; width:auto;} /* level 0 */ .topnav ul { margin:0; padding:4px 0; float:left; width:auto; height:29px; background-color:#202020;} .topnav ul li { margin:0 4px; padding:0; float:left;} .topnav ul li a { display:block; margin:0; padding:6px 20px 7px; color:#bdbdbd; text-decoration:none; background:none; border:1px solid transparent;} .topnav ul li.current_page_item { } /* active item first level */ .topnav ul li.current_page_item a, .topnav ul li a.a_hover_main { color:#0e0e0e; text-decoration:none; background:#0ca3c2 url(images/menu_a.gif) repeat-x left top; border:1px solid #34c8e7;} /* on hover */ /* level 1 */ .topnav ul li ul { margin:0; padding:4px; width:170px; height:auto; top:29px; left:-4px;} /* position of submenu */ .topnav ul li ul li { margin:0; padding:0; float:none;} .topnav ul li ul li a { color:#3cb9d3; background:none; border:1px solid transparent;} .topnav ul li ul li a.have_submenu { } /* if item have submenu */ .topnav ul li ul li a:hover, .topnav ul li ul li a.have_submenu_hover { color:#fff; text-decoration:none; background:#0ca3c2 url(images/menu_a.gif) repeat-x left top; border:1px solid #34c8e7;} .topnav ul li ul li ul { top:-4px; left:170px;} /* position of submenu level 2 */

/* DESIGN NAV1 (categories) */ /* level 0 */

  1. nav1 ul { margin:0; padding:6px; float:left; width:auto; height:29px;}
  2. nav1 ul li { margin:0 4px; padding:0; float:left;}
  3. nav1 ul li a { display:block; margin:0; padding:6px 20px 7px; color:#bdbdbd; text-decoration:none; background:none; border:1px solid transparent;}
  4. nav1 ul li.current-cat { } /* active item first level */
  5. nav1 ul li.current-cat a,
  6. nav1 ul li a.a_hover_main { color:#0e0e0e; text-decoration:none; background:#0ca3c2 url(images/menu_a.gif) repeat-x left top; border:1px solid #34c8e7;} /* on hover */

/* level 1 */

  1. nav1 ul li ul { margin:0; padding:2px 0; width:170px; height:auto; top:29px; left:0px; background-color:#161616;} /* position of submenu */
  2. nav1 ul li ul li { margin:0; padding:0; float:none;}
  3. nav1 ul li ul li a { color:#3cb9d3; background:none; border-top:1px solid transparent; border-bottom:1px solid transparent; border-left:none; border-right:none;}
  4. nav1 ul li ul li a.have_submenu { } /* if item have submenu */
  5. nav1 ul li ul li a:hover,
  6. nav1 ul li ul li a.have_submenu_hover { color:#fff; text-decoration:none; background:#0ca3c2 url(images/submenu_a.gif) repeat-x left top; border-top:1px solid #fff; border-bottom:1px solid #fff;}
  7. nav1 ul li ul li ul { top:-2px; left:170px;} /* position of submenu level 2 */
  1. nav1 * { z-index:100;}

.topnav * { z-index:200;}

/* DO NOT EDIT!!! */ ul.menusm { list-style:none;} ul.menusm li { cursor:pointer; position:relative;} ul.menusm li a { position:relative;} ul.menusm li ul { display:none; position:absolute; list-style:none;} ul.menusm li ul li ul { position:absolute; list-style:none;}