登录 | 注册 | FAQ
Anonymous

Javascript not working on iphone

+ 发表回复

3 篇帖子 分页: 1 / 1


Javascript not working on iphone

ST » 周一 1月 15, 2018 8:22 am

Need help please

Below code are not working on my Iphone (details: Iphone 5 iOS 10.3.3), its worked on Firefox, IE

Here my code:

<!DOCTYPE html>

<html>

<head>

<title>Test JS on IOS</title>

<style>

#navigation {
height: 100%;
position: fixed;
width: 0%;
background-color: #262626;
overflow: scroll;
}

.iconclose {
font-size: 35px;
margin: 0;
padding: 8px 16px;
color: white;
font-family: 'Open Sans', sans-serif;
cursor: pointer;
display: inline-block;
}

.menu {
padding: 8px 16px;
display: block;
}

.menuA {
background-color: black;
width: 30px;
height: 5px;
cursor: pointer;
}

.menuB {
color: black;
font-size: 20px;
padding-left: 8px;
}

</style>

<script>
function showFunction() {
document.getElementById("navigation").style.width = "30%";
document.getElementById("cover").style.marginLeft = "30%";
}

function hideFunction() {
document.getElementById("navigation").style.width = "0";
document.getElementById("cover").style.marginLeft = "0";
}

</script>

</head>

<body>
<div id="navigation">
<p class="iconclose" onclick="hideFunction()">X</p>
</div>

<div>
<table class="menu">
<tr>
<td class="menuA" onclick="showFunction()"></td>
<td class="menuB" rowspan="4">Menu</td>
</tr>
<tr>
<td class="menuA" onclick="showFunction()"></td>
<td></td>
</tr>
<tr>
<td style="cursor: pointer;" onclick="showFunction()"></td>
<td></td>
</tr>
<tr>
<td class="menuA" onclick="showFunction()"></td>
<td></td>
</tr>
</table>
</div>

<div id="cover">
</body>

</html>
头像

ST

  • 帖子: 1
  • 注册: 周一 1月 15, 2018 8:20 am

Re: Javascript not working on iphone

taynguyenem » 周五 8月 17, 2018 7:56 am

Hi, you can try:
Change onclick in html to funtion javascript onclick
Ex:
$('. menuA').on('click', funtion(){
event of show funtion
});

teamviewer
头像

taynguyenem

  • 帖子: 20
  • 注册: 周一 2月 05, 2018 3:28 pm
--
Preview site only Html: teamviewdownload.com, winrarfree.net

Re: Javascript not working on iphone

Samantha14 » 周一 9月 03, 2018 9:47 am

As mentioned in the other answer your code has depreciated functions that are not supported by Safari browser anymore. Rather than using javascript, i advice you to use node.js for device compatibility. If you need assistance, you can hire professional services here.
头像

Samantha14

  • 帖子: 10
  • 注册: 周一 9月 03, 2018 6:46 am


+ 发表回复

分页: 1 / 1