diff options
| author | Bobby <[email protected]> | 2023-05-30 02:12:55 -0400 |
|---|---|---|
| committer | Bobby <[email protected]> | 2023-05-30 02:12:55 -0400 |
| commit | 4f9a36f99aac6f59b4a4db3afc13a5c7234f4a65 (patch) | |
| tree | a31f3ae5e11f358fff1a67bf1826ca1415a6f60f /static/js | |
| parent | d2fba26372bf390f4b9f56af09cea224c40e3cc9 (diff) | |
| download | thatcomputerscientist-4f9a36f99aac6f59b4a4db3afc13a5c7234f4a65.tar.xz thatcomputerscientist-4f9a36f99aac6f59b4a4db3afc13a5c7234f4a65.zip | |
Support for resolutions < 450 units
Diffstat (limited to 'static/js')
| -rw-r--r-- | static/js/phone_compatibility.js | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/static/js/phone_compatibility.js b/static/js/phone_compatibility.js new file mode 100644 index 00000000..f3a945f7 --- /dev/null +++ b/static/js/phone_compatibility.js @@ -0,0 +1,33 @@ +/** + * Phone compatibility JS, for handling things on phone as + * this site was written for desktop + */ + +const windowBreakpoint = 450; + +// Listen for window resize +$(window).resize(function() { + if($(window).width() > windowBreakpoint) { + $('#sidebar').css('display', 'block'); + $('#ハンバーガー').css('display', 'none'); + } else { + $('#sidebar').css('display', 'none'); + $('#ハンバーガー').css('display', 'block'); + } +}); + +$(document).ready(function() { + $('#ハンバーガー').click(function() { + $('#ham').toggleClass('open'); + if($('#sidebar').css('display') == 'none') { + $('#sidebar').css('display', 'block'); + $('body').css('overflow', 'hidden'); + $('#ハンバーガー').css('background-color', 'red'); + + } else { + $('#sidebar').css('display', 'none'); + $('body').css('overflow', 'auto'); + $('#ハンバーガー').css('background-color', 'transparent'); + } + }); +});
\ No newline at end of file |
