🐞 fix sidebar mobile-md scaling

ref #31
This commit is contained in:
Philipp Dormann 2021-01-13 21:37:29 +01:00
parent 4ab77c5557
commit fcd657c10e

View File

@ -24,19 +24,40 @@
) )
check = true; check = true;
})(navigator.userAgent || navigator.vendor || window.opera); })(navigator.userAgent || navigator.vendor || window.opera);
const aspectratio=window.innerWidth/window.innerHeight;
if(aspectratio<=0.765){
check=true;
}
return check; return check;
} }
$: mobile = ismobile(); $: mobile = ismobile();
window.addEventListener('resize', function(){
const aspectratio=window.innerWidth/window.innerHeight;
if(aspectratio<=0.765){
navOpen=false;
mobile=true;
}else{
navOpen=true;
mobile=false;
}
});
// $: if (mobile===true) {
// console.log("changed to mobile");
// }
// $: if (mobile===false) {
// console.log("changed to md");
// }
function logout() { function logout() {
localForage.clear(); localForage.clear();
location.replace("/"); location.replace("/");
} }
</script> </script>
<section class="min-h-screen bg-gray-50 dark:bg-black dark:text-gray-100"> <section class="min-h-screen bg-gray-50">
<nav <nav
class:hidden={!navOpen && mobile} class:hidden={!navOpen && mobile}
class="select-none fixed top-0 left-0 z-20 h-full pb-10 overflow-x-hidden overflow-y-auto transition origin-left transform border-r w-60 md:translate-x-0"> class="select-none fixed top-0 left-0 z-20 h-full pb-10 overflow-x-hidden overflow-y-auto transition origin-left transform border-r w-60 md:translate-x-0 bg-gray-50">
<a href="/" class="flex items-center px-4 py-5"> <a href="/" class="flex items-center px-4 py-5">
<img <img
src="/lfk-logo.png" src="/lfk-logo.png"