I created a simple switch menu that, when clicked, shows a list of children, and if you click again, it hides these visible elements.
If a child is clicked, but I want him to visit this page, only I can not get it to work? Is this due to my default warning?
// Language select in global nav $('.sub-lang').on('click', function(e) { if ($(this).hasClass('active') && $(e.target).parent().hasClass('active')) { $(this).removeClass('active'); $(this).css('height', 'auto'); $(this).children('ul').hide(); } else { $(this).addClass('active'); $(this).css('height', $(this).find('ul').height() + 65); $(this).children('ul').show(); } e.preventDefault(); });
Here is jsfiddle
source share