How to make the Sidebar-Toggle sticky on scroll


#1

Hi,

I would like to make the “Sidebar-Toggle” and the “fa-plus” sticky on scroll.
For the moment in my website, they are fixed on top.
How can I do that, if it’s possible, please?

Regards,
Marion.


#2

Hi there,

You need to add javascript code and CSS code to do that.

jQuery(window).scroll(function (event) {
	var scroll = jQuery(window).scrollTop();
	if(scroll > 100){
		jQuery('#masthead').addClass('header-scrolled');
    }else{
		jQuery('#masthead').removeClass('header-scrolled');
	}
})
  • CSS
    Add these CSS code into: Customize > additional CSS
.sidebar-toggle {
    display: none;
}
.header-scrolled .sidebar-toggle {
    display: block;
}

Regards,
Awan