Добавил файл Scroll.js для появление панели навигации при скролле страницы
This commit is contained in:
parent
158409f158
commit
765c57632f
18
static/js/Scroll.js
Normal file
18
static/js/Scroll.js
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
var prevScrollpos = window.pageYOffset;
|
||||||
|
window.onload = function()
|
||||||
|
{
|
||||||
|
document.getElementById("navbar").style.display = "none";
|
||||||
|
}
|
||||||
|
window.onscroll = function() {
|
||||||
|
var currentScrollPos = window.pageYOffset;
|
||||||
|
|
||||||
|
// 20 is an arbitrary number here, just to make you think if you need the prevScrollpos variable:
|
||||||
|
if (currentScrollPos > 1250) {
|
||||||
|
// I am using 'display' instead of 'top':
|
||||||
|
document.getElementById("navbar").style.display = "initial";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
document.getElementById("navbar").style.display = "none";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -1,4 +1,5 @@
|
|||||||
<link rel="stylesheet" href="../static/css/main.css">
|
<link rel="stylesheet" href="../static/css/main.css">
|
||||||
|
<script src="../static/js/Scroll.js"></script>
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user