Menu icon Foundation
Off-canvas menu not auto-closing

Hello everyone,
I could use some help with this issue. I am using the off-canvas menu for a website but I cannot make it auto-close after clicking a menu link, external or anchor.
The website is www.francescodifiore.com
Any help?

Thanks a lot!

off-canvas menuauto-close

Hello everyone,
I could use some help with this issue. I am using the off-canvas menu for a website but I cannot make it auto-close after clicking a menu link, external or anchor.
The website is www.francescodifiore.com
Any help?

Thanks a lot!

Rafi Benkual about 4 years ago

So I see you have a scrolling plugin for clicking a menu item. If you want the menu to close when you click a menu item, there is an option for that:

This goes where you initialize Foundation

 $(document).foundation({
  offcanvas : {
    // Should the menu close when a menu link is clicked?
    // [ true | false ]
    close_on_click : false
  }
});

valeria di matteo about 4 years ago

Rafi many thanks for your help and suggestion (sorry for my late response).
Unfortunately I cannot get that to work. I initialize Foundation in a separate foundation.js file, after a Steve Zehngut tutorial (http://wordpress.tv/2014/06/11/steve-zehngut-build-a-wordpress-theme-with-foundation-and-underscores/).
When I try to set the option you suggested, the offcanvas simply stop working.
Any clue?

Thanks again!

Graham Dunsby over 3 years ago

Rafi

I'm having the exact same problem as above and although I tried your other suggestion using the data option 'data-close-on-click' I still have the same problem.

GD

Andres Davidovits over 3 years ago

Thank you in advance for any help here. My question: how do you 'initialize Foundation' (per Rafi's guidance above)? Where do I paste the code Rafi suggested (see below):

 $(document).foundation({

  offcanvas : {

    // Should the menu close when a menu link is clicked?

    // [ true | false ]

    close_on_click : false

  }

});

Dennis over 3 years ago

Inside the script-tags as described in the documentation.