From 29959d2e8c5037d554afce03fc141495394bf484 Mon Sep 17 00:00:00 2001 From: Christoph Zwerschke Date: Wed, 20 May 2020 17:26:19 +0200 Subject: [PATCH] Make the switcher sticky at the top of the page --- index.html | 9 ++++++++- switcher.js | 7 ++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index d10a5db..53e02e6 100644 --- a/index.html +++ b/index.html @@ -8,6 +8,13 @@ body { padding-left: 24px; } + #switcher { + position: sticky; + top: 0; + padding-bottom: 9px; + background: white; + box-shadow: 0 2px 1px -1px #ccc; + } + diff --git a/switcher.js b/switcher.js index d663b5b..6a92a85 100644 --- a/switcher.js +++ b/switcher.js @@ -40,10 +40,11 @@ function add_switcher() { head.appendChild(link); } - var new_div = document.createElement("div"); - new_div.innerHTML = '
 
\n '; + var new_div = document.createElement('div'); + new_div.id = 'switcher'; + new_div.innerHTML = '
 
\n '; document.body.insertBefore(new_div, document.body.firstChild); - document.body.style.paddingLeft = "24px" + document.body.style.paddingLeft = "24px"; inline_switcher(); }