Skip to content

Commit

Permalink
Further adjust viewport width for ipad
Browse files Browse the repository at this point in the history
  • Loading branch information
ffont committed Jan 20, 2024
1 parent 57b1605 commit 58fd9d9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
<meta charset="utf-8">
<meta name="viewport" content="width=0">
<script>
var isIpad = (/iPad/.test(navigator.userAgent))
var minWdth = isIpad ? 400:580;
function update_viewport_width_if_needed(){
var adjustedWidth = window.innerWidth / window.devicePixelRatio;
if (adjustedWidth < 580){
if (adjustedWidth < minWdth) {
document.querySelector('meta[name="viewport"]').setAttribute('content', 'width=580');
} else {
document.querySelector('meta[name="viewport"]').setAttribute('content', 'width=0');
Expand Down

0 comments on commit 58fd9d9

Please sign in to comment.