2016-07-07 59 views
1

我发现iOS设备上显示Google Apps脚本HtmlService的问题。如果html的内容高于视口的高度,则iOS设备不启用滚动。有什么办法可以强制这个吗?以下代码将重现iOS设备上的问题。Google Apps脚本中iOS视口的问题

function doGet() { 
    return HtmlService.createTemplateFromFile('html') 
     .evaluate().setSandboxMode(HtmlService.SandboxMode.IFRAME).addMetaTag("viewport", "width=device-width,initial-scale=1").setTitle("Whatever") 

} 


"html" file 

<!DOCTYPE html> 
<html lang="en"> 
<head> 
<meta charset="utf-8"> 

<title>Prep Notes Viewer-Editor</title> 



<link type="text/css" rel="stylesheet" > 

</head> 


<body> 

<div id="output"> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Line <br> 
Last Line 
</div> 

</body> 
</html> 
+0

你应该公布你的脚本,并给每个人的匿名访问,并张贴喜欢这里,使人们可以测试它。 –

+0

这是一个链接。 https://script.google.com/d/1j2I3Gr6qXbN5PQjq4tBIb2dex4mVkNRYBLf5mLiCWCVlFYi2-MC7QY9Y/edit?usp=sharing – user2970721

回答

1

我想通了一个办法。

后身体右侧添加一个div元素(姑且称之为#backgroundBox),围绕着整个身体的HTML,那div元素的CSS设置为:

#backgroundBox{ 
    height:100%; 
    width:100%; 
    position:absolute; 
    top:0%; 
    left:0%; 
    margin:0px; 
    padding:0px; 
    overflow:scroll; 
} 

又一次的HTML会是什么样子这样的:

"html" file 

<!DOCTYPE html> 
<html lang="en"> 
<head> 
<meta charset="utf-8"> 

<title>Prep Notes Viewer-Editor</title> 



<link type="text/css" rel="stylesheet" > 

</head> 


<body> 
<div id="#backgroundBox"> 
    <div id="output"> 
    Line <br> 
    Line <br> 
    MORE LINES 
    </div> 
</div> 
</body> 

+0

注意:使用此修补程序的iOS设备的惯性滚动。如果添加-webkit-overflow-scrolling:touch;问题返回到你无法滚动的地方。 – user2970721