0

一旦页面加载完成jQuery Mobile微调器就会消失。我希望微调器一直停留到某些事件(来自服务器的数据到达)之后:

$('#form').live('pagebeforeshow', function(){
   var def = $.Deferred();

   $.post('url', obj)
      .success(function (response) {
         def.resolve();
      });

   def.done(function(){
      // I want the spinner to disappear now.
   });
});
// in this point, once the 'pagebeforeshow' handler is returned,
// the spinner disappears - but I want it to stay only after def is resolved.

(顺便说一句,我想找到微调器被移除的点会更简单,然后重新显示它。我希望找到一个更优雅的解决方案,不会有这种风险(虽然风险很小,但仍然..)有那种闪烁)

4

1 回答 1

1

尝试添加.mobile.loading( 'show')$('#form').live('pageshow', function()当事件完成时,您可以使用.mobile.loading( 'hide').

于 2012-10-21T03:31:38.810 回答