From 2437c7e57806ef1d7ba80431b0da67c28a3e94df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yaroslav=20de=20la=20Pe=C3=B1a=20Smirnov?= Date: Tue, 9 Oct 2018 23:36:17 +0300 Subject: optimize floating sidebar mode for small screens --- weblog/templates/weblog/weblog.html | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'weblog/templates') 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; + } + }); {% endif %} {% endblock %} -- cgit v1.2.3