From 7dc976e3474d7583bdf08b3afc25e30d24cfce22 Mon Sep 17 00:00:00 2001 From: Rodolphe Breard Date: Mon, 11 Jun 2018 13:33:20 +0200 Subject: [PATCH] Fix the navbar on the top for small displays --- navbar/static/navbar/navbar.js | 12 ++++++++++++ navbar/templates/navbar/navbar.html | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/navbar/static/navbar/navbar.js b/navbar/static/navbar/navbar.js index 174416f..60f062a 100644 --- a/navbar/static/navbar/navbar.js +++ b/navbar/static/navbar/navbar.js @@ -25,4 +25,16 @@ document.addEventListener('DOMContentLoaded', function () { }); } + // Fix the navbar for small displays + if (window.screen.availWidth < 1088) { + var nb = document.getElementById('navBar'); + if (nb !== null) { + nb.className += " is-fixed-top"; + } + var ms = document.getElementsByTagName('html')[0]; + if (ms !== null) { + ms.className += " has-navbar-fixed-top"; + } + console.log(ms); + } }); diff --git a/navbar/templates/navbar/navbar.html b/navbar/templates/navbar/navbar.html index 83d8037..7e07f9c 100644 --- a/navbar/templates/navbar/navbar.html +++ b/navbar/templates/navbar/navbar.html @@ -1,7 +1,7 @@ {% load static %} {% load i18n %} -