Solved Helix Framework

Onepage - hide offcanvas after click on anchor link

Asked by Stephan 4 years ago Last activity 4 years ago

Hello all,
we have created a OnePage with Helix Ultimate and PB.
offcanvas works so far, only it is not hidden after clicking on an anchor link.
In your archive we found the following:


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

We have inserted the code at the end of main.js .
Afterwards, offcanvas is closed, but the anchor link does not work anymore.

Do you have any advice,
thanks in advance and greetings
Stephan

Accepted answer

Marked as the solution
Stephan Asked this

Hi Rashida,

thank you very much for the quick reply.

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

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

Many greetings
Stephan

4 more replies

Pavel

...end of main.js...

Hi Stephan. After updating the template, you will lose this in main.js. Therefore, create custom.js file and place the code there.

Stephan Asked this

Hi Pavel,

thanks for the tip :-)

Many greetings Stephan

Rashida Rahman Staff

Hi,

Glad that you have made it:)

You may accept the most useful answer in order to close the post.

Best Regards

Log in to reply.