Hide Offcanvas Menu - Forum | JoomShaper
Staff replied Helix Framework

Hide Offcanvas Menu

Asked by Karl Napf 3 years ago Last activity 3 years ago

How can I hide the offcanvas menu after click on anchor link? The customer wants it to dissapear after click.

Thx

1 reply

Paul Frankowski Senior Staff

Hi Karl,

from Helix settings you cannot - it request extra custom JavaScript.
We had few topics about that, and one of users shared below two tips:

1st:

// Offcanvas hack for one page website
var nav_collapse = $('.offcanvas-menu .menu');
nav_collapse.click('li a', function(event) {
       event.preventDefault();
    $('.offcanvas-init').removeClass('offcanvas-active');
});

2nd: For us, the single line at the end of main.js now works:

jQuery('.offcanvas-menu .menu').click(function(){jQuery('.close-offcanvas').trigger('click')});

I only shared, no support.

Log in to reply.