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

49 lines
965 B
JavaScript
Executable File

var scroll_pos = 0;
var transparent = true;
var offset = 100;
function makeTransparent()
{
$("#mind-global-navbar_primary").removeClass('mind-global-navbar_primary-colored').addClass('mind-global-navbar_primary-transparent');
transparent = true;
}
function makeOpaque()
{
$("#mind-global-navbar_primary").removeClass('mind-global-navbar_primary-transparent').addClass('mind-global-navbar_primary-colored');
transparent = false;
}
$(document).ready(function() {
$("#mind-global-navbar_primary").addClass('mind-global-navbar_primary-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();
}
}
});
});