I am trying to implement accordion with WordPress navigation menu. It works completely fine in Firefox, chrome, safari and opera but when IE comes its not working at all. Even it is not adding class for child elemnts.
Here is the code what I am using. Please help me to solve this completely stuck on my project.
- jQuery(document).ready(function () {
- //this code i have added as you said
- jQuery('#nav > li').each(function(){
- if (jQuery(this).find('ul').length > 0)
- {
- //item has children; do whatever you want
- jQuery(this).addClass('haschilds');
-
- }
- });
- var checkCookie = jQuery.cookie("nav-item");
-
- if (checkCookie != "") {
- jQuery('#nav > li > a:eq('+checkCookie+')').addClass('active').next().show();
- }
- jQuery('#nav > li > a').click(function(){
-
- var navIndex = jQuery('#nav > li > a').index(this);
-
- jQuery.cookie("nav-item", navIndex);
- jQuery('#nav li ul').slideUp('fast');
-
- if (jQuery(this).next().is(":visible")){
-
- jQuery(this).next().slideUp('fast');
-
- } else {
-
- jQuery(this).next().slideToggle('fast');
-
- }
-
- jQuery('#nav li a').removeClass('active');
- jQuery(this).addClass('active');
-
- });
-
- });