Search code examples
zurb-foundation-6off-canvas-menu

Foundation 6 offcanvas toggle jumps to top


Goodmorning, I wonder if there is a way to prevent Foundation 6's toggle off-canvas from jumping to the top of the page. I notice that this behaviour is also present in official F6 documentation


Solution

  • I found a temporary solution. In foundation 6, off-canvas options "forceTop" is currently disabled. If you don't want this behaviour, just go to

    bower_components/foundation-sites/js/foundation.offcanvas.js

    and comment, at line 211

    $('body').scrollTop(0);

    The rebuild all the assets.

    Hope this helps

    EDIT If you wish, it was fixed in development version, and you can grab the correct file. Or you can just add

    if ( this.options.forceTop ) { $('body').scrollTop(0); }

    to yours in order to restore forceTop option.

    Cheers