jQuery Mobile-延迟自动隐藏地址栏 [英] Jquery mobile - Delay auto hiding address bar

查看:77
本文介绍了jQuery Mobile-延迟自动隐藏地址栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很高兴地使用JQuery Mobile开发了一个移动网站,除了在首页上隐藏浏览器地址栏(在iOS Safari上大约5秒钟)会明显延迟之外,一切工作都很好.

AJAX过渡意味着从那时起它始终是隐藏的,但是在打开页面后,网站徽标在页面加载后最多隐藏5秒钟,给用户留下了非常烙印和混乱的感觉.

有人能想到延迟的任何原因/加快速度的方法吗?页面上没有大的图像加载,在隐藏地址栏之前在窗口加载事件中发出警报,并且JQuery Mobile代码中的代码触发的setTimeout延迟仅为20毫秒左右. >

提前感谢,泰德

解决方案

可悲的是,我不得不为此采用一种非常hacky的解决方案.

我在页面顶部添加了一个60px高的虚拟div分隔符,它将标题向下推,因此它始终可见.然后,在5秒钟setTimeout调用之后,Java脚本将其隐藏,这大致相当于我们在JQuery mobile自动隐藏的网址栏上获得的延迟.

这仅在开始页面上是必需的,而在我们不得不在rel ="external"链接上加载的其他页面上,这是必需的,这是因为我们将需要回发与JQuery mobile的ASP.net站点混合在一起时出错, 但这是另一个故事...

I've happily developed a mobile website using JQuery Mobile, and everything works beautifully except for a noticeable delay hiding the browser address bar on the homepage (around 5 seconds on iOS Safari).

AJAX transitions mean it's always hidden from that point on, but on the opening page the site logo is hidden for up to 5 seconds after the page has loaded, giving it a very unbranded and confusing feel for the user.

Can anyone think of any reasons for the delay / ways to speed it up? There are no large images loading on the page, putting an alert in the window load event fires way before the address bar is hidden and the setTimeout delays on the code firing in the JQuery Mobile code are only of the order of 20 ms.

Thanks in advance, Ted

解决方案

Sadly I've had to resort to a pretty hacky solution to this.

I've added a dummy 60px high spacer div at the top of the page, which pushes down the title, so it is visible at all times. This is then hidden by Javascript after 5 second setTimeout call, which is roughly equivalent to the delay we get on the url bar being auto-hidden by JQuery mobile.

This is only necessary on the start page, and other ones that we've had to load on rel="external" links, due to us making the error of mixing an ASP.net site that requires postback with JQuery mobile, but that's another story...

这篇关于jQuery Mobile-延迟自动隐藏地址栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆