Ajax动画JQuery 1.9.2 [英] Ajax Animation JQuery 1.9.2

查看:43
本文介绍了Ajax动画JQuery 1.9.2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将如何升级此问题中提供的解决方案如何创建请稍候,正在加载..."动画使用jQuery吗?

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

使用JQuery 1.9.2吗?

to work with JQuery 1.9.2?

我似乎无法正常工作.我尝试了以下 http://jsfiddle.net/VpDUG/2485/

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"); });

但这没用吗?

推荐答案

我想你打算这样做(第二个使用 ajaxStop()):

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"); });

查看它在jsFiddle的修改版本上的工作原理: http://jsfiddle.net/jfriend00/gk3RL/

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

此外,使用 document.body 代替"body" :

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

这篇关于Ajax动画JQuery 1.9.2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆