Modena 2.1.3 top-menu issue

Post Reply
RElliott
Posts: 89
Joined: 07 Feb 2014, 00:39

16 May 2017, 19:01

After upgrading from Modena 2.1.1 to Modena 2.1.3, my top-menu links stopped working. I tracked the issue down to line 134 of the layout.js file and resolved by commenting out the e.preventDefault() statement as shown below.

Code: Select all

//topbar
this.topMenu.find('a').off('click.topmenu mouseenter.topmenu').on('click.topmenu', function(e) {
    var link = $(this),
    submenu = link.next('ul');
    
    if(submenu.length) {
        if(submenu.hasClass('active-menu')) {
            submenu.removeClass('active-menu');
            link.removeClass('active-menu');
            $this.topMenuActive = false;
        }
        else {
            $this.topMenu.find('> li > ul.active-menu').removeClass('active-menu').prev('a').removeClass('active-menu');
            link.addClass('active-menu').next('ul').addClass('active-menu');
            $this.topMenuActive = true;
        }
    }
    else {
        if($(e.target).is(':not(:input)')) {
            $this.topMenu.find('.active-menu').removeClass('active-menu');
            $this.topMenuActive = false;
        }
    }
    //e.preventDefault();
})
PrimeFaces 6.1, Glassfish 4.1.2, Oracle JDK 8, Eclipse Luna

User avatar
aragorn
Posts: 2658
Joined: 29 Jun 2013, 12:38

17 May 2017, 15:10

Could you please try it after making the following changes?

Code: Select all

//topbar
this.topMenu.find('a').off('click.topmenu mouseenter.topmenu').on('click.topmenu', function(e) {
    var link = $(this),
    submenu = link.next('ul');
    
    if(submenu.length) {
        if(submenu.hasClass('active-menu')) {
            submenu.removeClass('active-menu');
            link.removeClass('active-menu');
            $this.topMenuActive = false;
        }
        else {
            $this.topMenu.find('> li > ul.active-menu').removeClass('active-menu').prev('a').removeClass('active-menu');
            link.addClass('active-menu').next('ul').addClass('active-menu');
            $this.topMenuActive = true;
        }
    }
    else {
        if($(e.target).is(':not(:input)')) {
            $this.topMenu.find('.active-menu').removeClass('active-menu');
            $this.topMenuActive = false;
        }
    }
    /****************** Please add these lines ********************/
            var href = link.attr('href');
            if(href && href !== '#') {
                window.location.href = href;
            }
    /*************************************************************/
    e.preventDefault();
})

RElliott
Posts: 89
Joined: 07 Feb 2014, 00:39

21 May 2017, 06:30

This worked for me. Thanks!
PrimeFaces 6.1, Glassfish 4.1.2, Oracle JDK 8, Eclipse Luna

User avatar
aragorn
Posts: 2658
Joined: 29 Jun 2013, 12:38

23 May 2017, 08:38

Glad to hear, thanks for the update!

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest