mind-overflow-website-ghost.../assets/js/scroll-navbar-color.js

49 lines
853 B
JavaScript
Executable File

var scroll_pos = 0;
var transparent = true;
var offset = 100;
function makeTransparent()
{
$("#navbar").removeClass('navbar-colored').addClass('navbar-transparent');
transparent = true;
}
function makeOpaque()
{
$("#navbar").removeClass('navbar-transparent').addClass('navbar-colored');
transparent = false;
}
$(document).ready(function() {
$("#navbar").addClass('navbar-allowmoving');
scroll_pos = $(this).scrollTop();
if(scroll_pos > offset)
{
makeOpaque();
}
else
{
makeTransparent();
}
$(document).scroll(function() {
scroll_pos = $(this).scrollTop();
if(transparent)
{
if(scroll_pos > offset)
{
makeOpaque();
}
}
else
{
if(scroll_pos <= offset)
{
makeTransparent();
}
}
});
});