1、很多資料說(shuō),添加以下代碼,可以隱藏地址欄,但我試了很多次,貌似不成功啊。
代碼如下:
window.scrollTo(0, 1);
$("div").css("height",window.innerHeight); //重置成新高度
document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false); //如果不想讓頁(yè)面滑動(dòng),可以加上這段代碼
4、分享一下開(kāi)源項(xiàng)目
移動(dòng)前端界面進(jìn)去的時(shí)候,我們會(huì)看到地址工具條,這看起來(lái)不怎么像一個(gè)APP,那么怎么隱藏掉這個(gè)地址條,下面提供了一個(gè)比較合適的代碼,支持ios和Android.
代碼如下:
// If there's a hash, or addEventListener is undefined, stop here
if(!win.navigator.standalone && !location.hash && win.addEventListener ){
//scroll to 1
w
//reset to 0 on bodyready, if needed
bodycheck = setInterval(function(){
if( doc.body ){
clearInterval( bodycheck );
scrollTop = getScrollTop();
win.scrollTo( 0, scrollTop === 1 ? 0 : 1 );
}
}, 15 );
win.addEventListener( "load", function(){
setTimeout(function(){
//at load, if user hasn't scrolled more than 20 or so...
if( getScrollTop() < 20 ){
//reset to hide addr bar at onload
win.scrollTo( 0, scrollTop === 1 ? 0 : 1 );
}
}, 0);
}, false );
}
})( this );
如果你的瀏覽器支持標(biāo)簽隱藏的話(huà):
代碼如下:
|
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注