Hide URL bar without hiding Smart App Banner on iOS

末鹿安然 提交于 2019-12-10 14:35:11

问题


Is it possible to hide the address URL bar but not the Smart App Banner on iOS Safari?

I have tried the solutions from this question: Hiding address bar without hiding the smart app banner on iOS 6, but it doesn't seem to work. The Smart Banner still gets hidden when I use MBP.hideUrlBarOnLoad from https://github.com/h5bp/mobile-boilerplate/blob/master/js/helper.js, as the answer suggests to do.


回答1:


I use:

    $(document).ready(function () {
        mob.SetUpEvents();
        setTimeout(function () {
            if (jQuery("html.iphone").length > 0) {
                jQuery('html').css( "height", ( jQuery(window).height() + 60) + 'px');
                window.ScrollTo(0, 1);
            }
        }, 400);
    });

I hope this helps!




回答2:


The only reason this works is because it throws a javascript error on

mob.SetUpEvents();

Which makes it disable the scroll jump. It will however mess up additional javascript.

You can change it to anything which throws a javascript error and the banner will not hide.

This solution is not an effective one.

Thank You

The website volotea.com that you have linked to does not work, when the page loads it jumps and hides the smart app banner and the url bar both. We have to scroll up to see the smart-app-banner.



来源:https://stackoverflow.com/questions/18344178/hide-url-bar-without-hiding-smart-app-banner-on-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!