I'm having trouble with the code snippet below. My goal is to utilize .cbp-fbscroller
in my CSS to show a new side navigation menu on my HTML page only when scrolling down to 900px. However, as someone who is new to JavaScript, I am struggling to make this code work.
Once the scroll reaches 900px, the side navigation should become visible. I have created a fiddle so that you can see more of the code
$(document).scroll(function(){
if ($(document).scrollTop() >= 100) {
if ($(".main").css('display') === 'none') {
$(".cbp-fbscroller").fadeIn('slow');
$(".main").prev().fadeOut();
$(".cbp-fbscroller").next().fadeOut();
}
} else {
/* if ($(".main").css('display') !== 'none') {
$(".cbp-fbscroller").fadeOut('slow');
$(".main").prev().fadeIn();
$(".cbp-fbscroller").next().fadeIn();
} */
}
})