2015-05-29 32 views
0

我想禁用滾動,但可以在iPhone中拖動<canvas>
在以下代碼中,當您拖動<canvas>時,整個頁面也會滾動。這是不想要的。
禁用滾動,但在iPhone中啓用拖動

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/> 
<style type="text/css"> 
body { 
    overflow: hidden; 
    width: 100%; 
} 
</style> 
</head> 
<body> 
    <canvas width="320px" height="480px"></canvas> 
</body> 

回答

0

我自己解決它,通過添加以下代碼。

position: fixed;