【问题标题】:jqtouch - no loading image appearsjqtouch - 没有加载图像出现
【发布时间】:2010-07-28 19:58:31
【问题描述】:

我正在使用 jqtouch 创建一个 Web 应用程序,并有一个指向外部 html 页面的 ajax 链接。当有互联网连接时链接工作正常,但当连接不可用时,没有“加载”消息。

这应该是 jqtouch 中的默认行为吗?如果有,是什么原因导致图片不显示?

感谢您的帮助

【问题讨论】:

  • 你能发布一些示例代码来澄清一下吗?
  • 此代码用于“rounded”类的无序列表:
  • career.uga.edu/mobilewebapp/ccajaxevents.html">UpcomingEvents
  • I加载外部页面时需要“加载”动画在屏幕上播放。“loading.gif”图像正在页面上的脚本中预加载,但我不知道如何使其在链接时显示被点击。在相关说明中,我需要显示需要网络连接才能访问链接的通知(如果没有连接)。这是 jqtouch 的功能吗?感谢您的帮助

标签: jquery jqtouch


【解决方案1】:

我自己做的。

JS代码:

$(function(){
    $('#link').tap( function(e){
        $('#myloading').css("display","");
        window.location = this.href;
        return false;
    });
    $('#myloading').center();
});
jQuery.fn.center = function () {
    this.css("position","absolute");
    this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");
    this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px");
    return this;
}

并在页面上放一个div:

<div style="display:none;" id="myloading">
    <img src="/css/jqtouch/apple/img/ajax-loader.gif" />
</div>

以及所有外部链接,例如:

<a id="link" href="page.html">My links</a>

结论:

我将所有链接转换为在点击事件上工作。

希望它能解决你的问题。

【讨论】:

    猜你喜欢
    相关资源
    最近更新 更多
    热门标签