I'm using helix3 template and I want to make the menu sticky to the top of the page, and to change its style when scrolling. how can I achieve that!
2 Answers
Based on the template demo and , I put together a quick solution using jQuery and CSS, but if your template has been customized, this might not work as expected:
CSS
.fixedMenu {
position: fixed;
top: 0;
z-index: 10;
width: 100%;
}
jQuery
jQuery(window).bind('scroll', function () {
if (jQuery(window).scrollTop() > 90) {
jQuery('#sp-header').addClass('fixedMenu ');
} else {
jQuery('#sp-header').removeClass('fixedMenu ');
}
});
Having done a quick Google search (hint), I believe the Helix 3 templates supports a fixed/sticky header in the Template Options:
-
-
Template is probably poorly made then. You need to reviews it's code and change it there directly. Commented Apr 11, 2016 at 16:40
-