Home > Article > Web Front-end > HTML5 actual combat and analysis of the mobile IOS system shrinking the address navigation bar function
A few days ago, I shared with you some relevant introductions about the structure and tags of the mobile terminal. Today I will continue to introduce to you a small function, that is, the mobile terminal IOS system shrinks the address navigation bar. Function.
JavaScript code##
// 它只有一个参数,该参数表示被调用的函数名(在页面加载完毕时执行的函数的名字) function addLoadEvent(func) { var oldOnload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { oldOnload(); func(); } } } // 添加Load事件处理 addLoadEvent(hideMenu); function hideMenu() { setTimeout("window.scrollTo(0, 0)", 1); } //以上代码是针对IOS系统的移动端收缩地址导航栏作用的(部分安卓机也可以)。核心代码其实就是一句: //setTimeout("window.scrollTo(0, 0)", 1);意思是说将坐标移到(0,0)点在0.001秒后执行 //利用定时器,将窗口移动到内容端的最上端。从而隐掉地址导航栏。The above is the HTML5 actual combat and analysis of the shrink address navigation bar function of the mobile IOS system Content, please pay attention to the PHP Chinese website (www.php.cn) for more related content!