Im working on a multilevel accordeon menu using Jquery. Everything works fine when toggle the first submenu but when i have one more level of submenus they don't show up / don't do anything. Im pretty sure it's because of something im not doing quit well with the css treatment on the jquery but i just can't figure it out.
Here's the online test:
You can check the problem clicking on the first option ("Actualitat dia a dia") and then on the last item of the submenu ("Actualidad") that have also a submenu but it doesn't show up or toggle.
Here's the jquery
$(document).ready (function(){
$(".menu-desplegable > ul > li:has(ul)").addClass("has-sub");
$('.menu-desplegable > ul > li > a').click(function() {
var checkElement = $(this).next();
$('.menu-desplegable li').removeClass('active');
$(this).closest('li').addClass('active');
if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
$(this).closest('li').removeClass('active');
checkElement.slideUp('normal');
}
if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
$('.menu-desplegable ul ul:visible').slideUp('normal');
checkElement.slideDown('normal');
}
if (checkElement.is('ul')) {
return false;
} else {
return true;
}
});
});