大佬教程收集整理的这篇文章主要介绍了jQuery:淡出 – 做点什么 – 淡出模式,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
淡出==>做一些幕后故事==>淡入
如下图所示:
/// <reference path="jquery-1.4.2.js" /> /// <reference path="jquery-1.4.2-vsdoc.js" /> /// <reference path="jquery.validate-vsdoc.js" /> var fade = "slow"; $(document).ready(function () { // Some event occurs $("#Trigger").change(function () { var id = $(this).find(":selected").val(); // Fade out target while I do something $("#Target").fadeOut(fade,function () { if (id != "") { // Do Something $("#Target").load( "/Site/Controller/Action/"+id,null,function () { // Fade in Target $("#Target").fadeIn(fade); }); } }); }); });
这工作正常,但回调层次结构变得非常深,我只是想知道是否有更简单的方法来做这个或更好的技术,不会导致这么多级别的回调
.queue
$("#Target") .fadeOut() .queue(function() { if (id != "") // Do Something $(this).load( "/Site/Controller/Action/"+id,$(this).dequeue ); else $(this).dequeue(); }) .fadeIn()
以上是大佬教程为你收集整理的jQuery:淡出 – 做点什么 – 淡出模式全部内容,希望文章能够帮你解决jQuery:淡出 – 做点什么 – 淡出模式所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。