weixin_33727510 2013-03-27 22:21 采纳率: 0%
浏览 40

Ajax动画JQuery 1.9.2

How would i upgrade the solution provided in this question How can I create a "Please Wait, Loading..." animation using jQuery?

to work with JQuery 1.9.2?

I can't seem to get it to work. I've tried the following http://jsfiddle.net/VpDUG/2485/

$(document).ajaxStart(function(){   $("body").addClass("loading"); });
$(document).ajaxStart(function(){   $("body").removeClass("loading"); });

but that hasn't worked?

  • 写回答

2条回答 默认 最新

  • bug^君 2013-03-27 22:25
    关注

    I think you meant to do this (using ajaxStop() for the second one):

    $(document).ajaxStart(function(){   $("body").addClass("loading"); });
    $(document).ajaxStop(function(){   $("body").removeClass("loading"); });
    

    See it working here on a modified version of your jsFiddle: http://jsfiddle.net/jfriend00/gk3RL/


    Also, a little more efficient to use document.body instead of "body":

    $(document).ajaxStart(function(){   $(document.body).addClass("loading"); });
    $(document).ajaxStop(function(){   $(document.body).removeClass("loading"); });
    
    评论

报告相同问题?

悬赏问题

  • ¥15 学不会递归,理解不了汉诺塔参数变化
  • ¥15 基于图神经网络的COVID-19药物筛选研究
  • ¥30 软件自定义无线电该怎样使用
  • ¥15 R语言mediation包做中介分析,直接效应和间接效应都很小,为什么?
  • ¥15 Jenkins+k8s部署slave节点offline
  • ¥15 如何实现从tello无人机上获取实时传输的视频流,然后将获取的视频通过yolov5进行检测
  • ¥15 WPF使用Canvas绘制矢量图问题
  • ¥15 用三极管设计一个单管共射放大电路
  • ¥15 孟德尔随机化r语言运行问题
  • ¥15 pyinstaller编译的时候出现No module named 'imp'