Code
Einfügen in Yootheme > Settings > Custom Code > Script
// set site-wide scrolling offset
UIkit.mixin({data: {offset: 100}}, 'scroll');
// main navigation scroll-stuff
UIkit.util.ready(function () {
// main navigation scrollspy:
// mark closest matching navigation item
UIkit.scrollspyNav('ul.uk-navbar-nav', {closest: 'li', scroll: true});
// main navigation scroll
// smooth scrolling to anchors
UIkit.util.$$('.uk-navbar-nav a, .uk-nav a').forEach(function(el) {
if (location.hostname == el.hostname && location.pathname == el.pathname && el.href.charAt(0) != '#') {
UIkit.scroll(el, {offset: 90});
UIkit.util.on(el, 'beforescroll', function() {
// activate only when using menu style modal (Yootheme > Layout > Mobile> Menu animation)
UIkit.modal('#tm-mobile').hide();
// activate only when using menu style canvas (Yootheme > Layout > Mobile> Menu animation)
// UIkit.offcanvas('#tm-mobile').hide();
});
}
});
});