标签:scree 跳转 form document nav navig || == inux
加入js代码
<style type="text/css"> body { height: 2000px; } </style> <script type="text/javascript"> onload = function () { var dh = document.documentElement.scrollHeight || document.body.scrollHeight; window.scrollTo (0, (dh - screen.availHeight) / 2); } </script>
配合判断是否是手机端使用代码
<script type="text/javascript"> <!-- //平台、设备和操作系统 var system ={ win : false, mac : false, xll : false }; //检测平台 var p = navigator.platform; system.win = p.indexOf("Win") == 0; system.mac = p.indexOf("Mac") == 0; system.x11 = (p == "X11") || (p.indexOf("Linux") == 0); //跳转语句 if(system.win||system.mac||system.xll){ onload = function () { window.scrollTo (0,495); } }else{ //如若手机则跳转的页面路径 } --> </script>
html页面比较长,如何用js实现网页一打开显示在网页的中部?
标签:scree 跳转 form document nav navig || == inux
原文地址:https://www.cnblogs.com/zhangyouwu/p/9321631.html