2020-08-13 14:23:29 +02:00
|
|
|
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() {
|
2020-08-13 15:41:45 +02:00
|
|
|
|
|
|
|
$("#navbar").addClass('navbar-allowmoving');
|
2020-08-13 14:23:29 +02:00
|
|
|
scroll_pos = $(this).scrollTop();
|
2020-08-13 15:41:45 +02:00
|
|
|
|
2020-08-13 14:23:29 +02:00
|
|
|
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();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|