用vue 做移动端h5页面项目,想实现类似全屏效果,去掉手机浏览器的地址栏和底部工具条<meta name="browsermode" content="application"><meta name="full-screen" content="yes" /><meta name="x5-fullscreen" content="true" /><meta name="x5-page-mode" content="app" /><meta name="360-fullscreen" content="true" />项目是单页面模式,首次进入是好的,地址栏和工具条都没有,但是只要路径跳转,导航栏和工具条就会出现。手动刷新又会隐藏掉。我试着用js scrollTop方式实现也不行。为什么会出现这种情况,有什么办法解决吗。
2 回答
慕尼黑8549860
TA贡献1818条经验 获得超11个赞
试试这个demo
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <meta name="Generator" content="EditPlus"> <meta name="Author" content=""> <meta name="Keywords" content=""> <meta name="Description" content=""> <meta name="full-screen" content="true"> </head> <body> <div>123321</div> <script> //进入全屏 function requestFullScreen() { var de = document.documentElement; if (de.requestFullscreen) { de.requestFullscreen(); } else if (de.mozRequestFullScreen) { de.mozRequestFullScreen(); } else if (de.webkitRequestFullScreen) { de.webkitRequestFullScreen(); } } //退出全屏 function exitFullscreen() { var de = document; if (de.exitFullscreen) { de.exitFullscreen(); } else if (de.mozCancelFullScreen) { de.mozCancelFullScreen(); } else if (de.webkitCancelFullScreen) { de.webkitCancelFullScreen(); } } document.body.addEventListener('click', function () { requestFullScreen(); //exitFullscreen(); }, false); </script> </body> </html>
添加回答
举报
0/150
提交
取消