Skip to content

Commit

Permalink
Fixed iPad detection and layout (search bar & co. were hidden)
Browse files Browse the repository at this point in the history
  • Loading branch information
freetom committed Dec 14, 2023
1 parent 36fefb9 commit 64527f4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion contatti.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<tr box-shadow="1px 1px 8px rgba(0,0,0,0.3)">
<td id="ideavideo-home" valign="middle" align="center"><img
src="images/logoideavideo2017.png" id="ideavideo-logo"
alt="" style="margin-left: 25%;" width="301"
alt="" style="margin-left: 5%;" width="301"
height="58" align="middle"><br>
</td>
<td id="menu-servizi" class="menu-button" bgcolor="#ffffff" valign="middle"
Expand Down
2 changes: 1 addition & 1 deletion dicono-di-me.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
<tr box-shadow="1px 1px 8px rgba(0,0,0,0.3)">
<td id="ideavideo-home" valign="middle" align="center"><img id="ideavideo-logo"
src="images/logoideavideo2017.png"
alt="" style="margin-left: 25%;" width="301"
alt="" style="margin-left: 5%;" width="301"
height="58" align="middle"><br>
</td>
<td id="menu-servizi" class="menu-button" bgcolor="#ffffff" valign="middle"
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<tr box-shadow="1px 1px 8px rgba(0,0,0,0.3)">
<td id="ideavideo-home" valign="middle" align="center"><img id="ideavideo-logo"
src="images/logoideavideo2017.png"
alt="" style="margin-left: 25%;" width="301"
alt="" style="margin-left: 5%;" width="301"
height="58" align="middle"><br>
</td>
<td id="menu-servizi" class="menu-button" bgcolor="#ffffff" valign="middle"
Expand Down
12 changes: 10 additions & 2 deletions scripts/mobile_who_am_i.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
function setup_tablet(){
const userAgent = navigator.userAgent.toLowerCase();
const isTablet = /(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/.test(userAgent);
if (isTablet){
const isTablet = /(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/i.test(userAgent);
const isIpad = navigator.maxTouchPoints && navigator.maxTouchPoints > 2 && /MacIntel/.test(navigator.platform)
if (isTablet || isIpad){
// if landscape
if(window.innerHeight < window.innerWidth){
document.getElementsByClassName('block3')[0].style.marginTop = '110%'
Expand All @@ -16,6 +17,13 @@ function setup_tablet(){
document.getElementsByClassName('block5')[0].style.marginTop = '110%'
getById('bottom-table').style.marginTop = '280%'
}

if(isIpad){
elems = document.getElementsByClassName('common-block')
for(i=0;i<elems.length;i++){
elems[i].style.backgroundAttachment = 'scroll'
}
}
}
}

Expand Down

0 comments on commit 64527f4

Please sign in to comment.