I’ve got this page with the aside menu:

https://cmswebserv.com/drobak/klubben/golfkafeen/

and the following javascript:

var aside_menu_ul = $('.aside_menu_left'),
    aside_menu_ul_li = aside_menu_ul.find('li'),
    aside_menu_ul_li_ul = aside_menu_ul_li.find('ul');
    parrent_links = aside_menu_ul_li.has('ul').find('a').not('.aside_menu_left li ul li a');

//hide all submenus
aside_menu_ul_li_ul.hide();
//indicate witch parrent has children - TEMPORARY
aside_menu_ul_li.has('ul').addClass('par');

//mark 3 level navigation
aside_menu_ul_li.has('ul').find('li').has('ul').addClass('th_level');

parrent_links.click(function() {
    var t = $(this),
        t_li = t.parent('li'),
        child_ul = t_li.find('ul').first();
    //add parent link to the top of the dropdown
    if(child_ul.find('li.additional_li').length <= 0) {
        child_ul.prepend('<li class="page_item additional_li"><a href="'+t.attr('href')+'">'+t.text()+'</a></li>');
    }
    //hide all submenus
    aside_menu_ul_li_ul.slideUp(200);
    aside_menu_ul_li.removeClass('sec_expanded');

    //open sellected submenu
    if(child_ul.is(":visible")) {
        child_ul.slideUp(200);
        t_li.removeClass('sec_expanded');
    } else {
        child_ul.slideDown(200);
        t_li.addClass('sec_expanded');
    }

    return false;
});

//3rd level expanding
var th_links = $('.aside_menu_left li ul li').has('ul').find('a').not('.aside_menu_left li ul li ul li a');
th_links.click(function() {
    var t = $(this),
        t_li = t.parent('li'),
        th_level_ul = t_li.find('ul').first();
    if(t_li.has('ul')) {
        //add parent link to the top of the dropdown
        if(th_level_ul.find('li.additional_li').length <= 0) {
            th_level_ul.prepend('<li class="page_item additional_li"><a href="'+t.attr('href')+'">'+t.text()+'</a></li>');
        }
        //hide all submenus
        aside_menu_ul_li_ul.find('li ul').slideUp(200);
        //open sellected submenu
        if(th_level_ul.is(":visible")) {
            th_level_ul.slideUp(200);
            t_li.removeClass('th_expanded');
        } else {
            th_level_ul.slideDown(200);
            t_li.addClass('th_expanded');
        }
        return false;
    }
});


//autoopen sidebar menu if needed
$('.aside_menu_left > li').each(function() {
    var t = $(this),
        children_ul = t.find('ul').first(),
        children_li = children_ul.find('li');

    if(t.hasClass('current_page_ancestor') || t.hasClass('current_page_item')) {
        var parent_link = t.find('a').first();
        //console.log(parent_link);
        //t.addClass('sec_expanded');
        if(children_ul.find('li.additional_li').length <= 0) {
            children_ul.prepend('<li class="page_item additional_li"><a href="'+parent_link.attr('href')+'">'+parent_link.text()+'</a></li>');
        }
        children_ul.show();

        if(t.hasClass('current_page_item')) {
            var added  = children_ul.find('li.additional_li a').first();
            added.addClass('added_highlight');
        }
    }
});

//autoopen 3 rd level sidebar menu if needed
$('li.th_level').each(function() {
    var t = $(this),
        children_ul = t.find('ul').first(),
        children_li = children_ul.find('li');

    if(t.hasClass('current_page_ancestor') || t.hasClass('current_page_item')) {
        var parent_link = t.find('a').first();
        //console.log(parent_link);
        t.addClass('th_expanded');
        if(children_ul.find('li.additional_li').length <= 0) {
            children_ul.prepend('<li class="page_item additional_li"><a href="'+parent_link.attr('href')+'">'+parent_link.text()+'</a></li>');
        }
        children_ul.show();

        if(t.hasClass('current_page_item')) {
            var added  = children_ul.find('li.additional_li a').first();
            added.addClass('added_highlight');
        }

    }
});

but after adding ul.aside_menu_left:after to draw the white border inside, the javascript is not working fine.

Any idea?

Thank you!

Read more here: Javascript not working after adding a pseudo class :after


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: