JQTOUCH - 任何时候发生加载时,添加加载类?
我正在使用 JQTOUCH,在 JQTOUCH 中,几个链接正在通过 AJAX 加载,然后滑入。问题是没有向用户提供加载指示。
我想要一种方法,在加载 ajax 调用时添加带有 AJAX 微调器的 Loading 类,并在加载完成并显示页面时删除该类。
有什么想法吗?
I'm using JQTOUCH and in JQTOUCH several of the links are being loading via AJAX and then sliding in. The problem is that there is no loading indication provided to users.
I'd like a way to add a Loading class with an AJAX spinner, when ever the an ajax call is loading, and have the class removed when the loading is done, and the page is displayed.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
showPageByHref() 答案部分正确。
但是,
您需要
Body 对于 jqtouch 来说太笼统了,需要特定于当前显示的 DIV 页面
the showPageByHref() answer is partially correct.
But, instead of
You need
Body is too general for jqtouch, need to be specific to the currently displayed DIV-page
jqtouch js 中的 showPageByHref() 函数是一个好的开始。我将其添加到ajax调用中,这样当您单击已加载的链接等时,请稍候不会闪烁。
简而言之 - 在ajax调用之前添加加载div(exmaple中的id loadinginprogress)并删除稍后的“成功”或“错误”。 ajax 调用部分看起来像这样(缩短它):
用于加载 div 的 css 类似于:
showPageByHref() function in jqtouch js is a good start. i added it right into ajax call so the please wait will not flicker when you click on link that is already loaded etc.
In short - add loading div (id loadinginprogress in exmaple) right before the ajax call and remove later "success" or "error". the ajax call section would look something like that (shortened it ):
css for loading div would be something like:
如果您的链接是 li class="arrow" 元素,这是基本行为。您如何显示链接以及您希望加载旋转器显示在哪里?
This is the basic behavior if your links are li class="arrow" elements. how are you displaying your links and where do you want the loading-spinner to display?
感谢您的不同帖子。他们给了我很多帮助。
我有一个解决方案可以提出,无需修补 jQTouch 所依赖的 jQtouch 代码。
它使用 jQuery ajax 功能。
更多详细信息请参见此 jQuery 文档页面。
Thank you for your different posts. They helped me a lot.
I have a solution to propose without patching the jQtouch code on which jQTouch relies.
It uses jQuery ajax capabilities.
more details available in this jQuery doc page.
您可以添加自定义事件处理程序,并在每次单击特定元素时触发loading.gif。
You could add a custom event handler, and trigger the loading.gif everytime the click on the specific element was done.
我刚刚回答了达林·帕克的问题。只要检查一下它可能会对您有所帮助。
I just answered Darin Parker's question. Just check it out it may help you.