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
Asked
Active
Viewed 736 times
0
-
I tried passing the option forceTop to the plugin, but it doesn't work. var foo = new Foundation.OffCanvas($('#offCanvas')); foo.options.forceTop = false; – Marco Feb 05 '16 at 10:22
2 Answers
0
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

Marco
- 712
- 1
- 10
- 23
0
The easiest way is just use data-force-top=false
in your div attributes as below:
<div class="off-canvas position-right" id="offCanvasRight" data-force-top=false data-off-canvas data-position="right">

Urs
- 4,984
- 7
- 54
- 116