Solved Templates

one page website , hide menu on click

Asked by Pedros 3 years ago Last activity 3 years ago

HI, site: https://kancelariapsn.pl/
How to make the menu hide after clicking when I have a page in one page type

Accepted answer

Marked as the solution
Paul Frankowski Senior Staff
3 years ago · edited

I copied JS code from one of those topics:

// 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');
});

AND 2nd solution

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

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

Personally I cannot give you guarantee: if and how it works.

2 more replies

Paul Frankowski Senior Staff

Hi,

By default is not possible, it request extra changes in template main.js file.
There were at least two topics on forum with solutions made by users.

Log in to reply.