diff options
author | Yaroslav de la Peña Smirnov <contact@yaroslavps.com> | 2018-10-09 23:36:17 +0300 |
---|---|---|
committer | Yaroslav de la Peña Smirnov <contact@yaroslavps.com> | 2018-10-09 23:36:17 +0300 |
commit | 2437c7e57806ef1d7ba80431b0da67c28a3e94df (patch) | |
tree | fc00f04f1a919814bb4370ea75ee907a773e2e4a /weblog/templates | |
parent | 11b3c6ff961631309b72e86eddd1d70ce539474a (diff) | |
download | w3blog-2437c7e57806ef1d7ba80431b0da67c28a3e94df.tar.gz w3blog-2437c7e57806ef1d7ba80431b0da67c28a3e94df.zip |
optimize floating sidebar mode for small screens
Diffstat (limited to 'weblog/templates')
-rwxr-xr-x | weblog/templates/weblog/weblog.html | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/weblog/templates/weblog/weblog.html b/weblog/templates/weblog/weblog.html index e1907c6..25ef953 100755 --- a/weblog/templates/weblog/weblog.html +++ b/weblog/templates/weblog/weblog.html @@ -51,6 +51,18 @@ sidebar_filler.style.height = "10px"; window.addEventListener("scroll", floatSidebar); }); + window.addEventListener("resize", function(){ + if (screen.width > 760){ + var sb_width = document.querySelector(".weblog-sidebar.floating-sidebar").offsetWidth; + var sidebar_filler = document.querySelector(".sidebar-filler"); + sidebar_filler.style.width = sb_width+"px"; + sidebar_filler.style.height = "10px"; + } + else{ + var sidebar_filler = document.querySelector(".sidebar-filler"); + sidebar_filler.style.width = 0; + } + }); </script> {% endif %} {% endblock %} |