From 29959d2e8c5037d554afce03fc141495394bf484 Mon Sep 17 00:00:00 2001 From: Christoph Zwerschke Date: Wed, 20 May 2020 17:26:19 +0200 Subject: [PATCH 1/2] 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(); } From 2e00e7a6c1114d483d33d2bd074dc46fd16338fd Mon Sep 17 00:00:00 2001 From: Christoph Zwerschke Date: Mon, 1 Jun 2020 23:34:52 +0200 Subject: [PATCH 2/2] Adapt background in sticky switcher to selected theme --- index.html | 1 + switcher.js | 26 +++++++++++++++++--------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/index.html b/index.html index cb32578..d016a4e 100644 --- a/index.html +++ b/index.html @@ -14,6 +14,7 @@ padding-bottom: 9px; background: white; box-shadow: 0 2px 1px -1px #ccc; + z-index: 999999; } '; - document.body.insertBefore(new_div, document.body.firstChild); + document.body.prepend(new_div); document.body.style.paddingLeft = "24px"; inline_switcher(); + + css_link.onload = on_css_load; }