Onepage - Hide Offcanvas After Click On Anchor Link - Question | JoomShaper
SP Page Builder 6 is Here! Learn More →

Onepage - Hide Offcanvas After Click On Anchor Link

S

Stephan

Helix Framework 3 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

0
5 Answers
S
Stephan
Accepted Answer
3 years ago #76318

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

0
Rashida Rahman
Rashida Rahman
Accepted Answer
Support Agent 3 years ago #76291

Hi there!

Thnaks for your query.

As you can understand the Helix Ultimate Template is not made with onepage facility, so it happens. And customization support is prohibited here.

However, have you tried every part of the last comment at the end, please?

https://archive.joomshaper.com/forums/how-do-i-make-off-canvas-menu-close-on-one-page-website#reply-163585

Best Regards

0
Pavel
Pavel
Accepted Answer
3 years ago #76319

...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.

0
S
Stephan
Accepted Answer
3 years ago #76331

Hi Pavel,

thanks for the tip :-)

Many greetings Stephan

0
Rashida Rahman
Rashida Rahman
Accepted Answer
Support Agent 3 years ago #76398

Hi,

Glad that you have made it:)

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

Best Regards

0