Home > Web Front-end > H5 Tutorial > body text

HTML5 actual combat and analysis of the mobile IOS system shrinking the address navigation bar function

黄舟
Release: 2017-02-10 14:30:26
Original
1860 people have browsed it

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秒后执行
//利用定时器,将窗口移动到内容端的最上端。从而隐掉地址导航栏。
Copy after login

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 (m.sbmmt.com) for more related content!


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!