javascript - 带有 jquery mobile 的微调器

标签 javascript jquery jquery-mobile spinner

我正在尝试使用 jQuery Mobile 为我的页面设置微调器加载。然而,当我使用 Ajax 加载某些内容时,微调器不会显示出来。这是我的代码。有什么想法有什么问题吗?

$("#invite").live('pageinit', function(e) {
  var render = function (items) {
    var view = '',
    index = 0;
    items.forEach(function(date){
      view +=
        '<div class="ui-block" style="background:white;">' +
        date.address
        '</div>';
      index++;
    });
    return view;
  };
  $.mobile.showPageLoadingMsg();
  $.ajax({                  
    url: 'someurl.com/file.json',
    dataType: "json",
    success: function(data) {
      $('#list').html(render(data.shared_dates));
      $.mobile.hidePageLoadingMsg();
    }
  })
});

最佳答案

如果您使用的是 jQuery Mobile 1.2,那么您应该使用以下内容:

$.mobile.loading( 'show' )

$.mobile.loading( 'hide' )

文档:http://jquerymobile.com/demos/1.2.0/docs/api/methods.html

关于javascript - 带有 jquery mobile 的微调器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13525720/

相关文章:

javascript - 如何使 Bootstrap 不响应?

javascript - 如何使用过滤的 props 渲染 ReactJS 组件?

javascript - Leaflet.js/Browser 由于缺少图 block 文件而返回 500 个内部服务器错误

javascript - phonegap jquery 移动谷歌地图 api 显示灰色

jquery - listitem - 删除 - 动态

javascript - 如何从 localStorage 中删除该项目及其 key ?

javascript - jquery animate 让其他元素跳舞

javascript - 使用 javascript 模数来更新图 block 位置的行

jquery - 在单个请求中下载多个文件 (jQuery/Python)

jquery - 如果事件链接溢出,则将 mydiv 向上滚动到事件链接