| | 3767 | jQuery.fn.extend({ |
|---|
| | 3768 | |
|---|
| | 3769 | /** |
|---|
| | 3770 | * Displays each of the set of matched elements if they are hidden. |
|---|
| | 3771 | * |
|---|
| | 3772 | * @example $("p").show() |
|---|
| | 3773 | * @before <p style="display: none">Hello</p> |
|---|
| | 3774 | * @result [ <p style="display: block">Hello</p> ] |
|---|
| | 3775 | * |
|---|
| | 3776 | * @name show |
|---|
| | 3777 | * @type jQuery |
|---|
| | 3778 | * @cat Effects |
|---|
| | 3779 | */ |
|---|
| | 3780 | |
|---|
| | 3781 | /** |
|---|
| | 3782 | * Show all matched elements using a graceful animation and firing an |
|---|
| | 3783 | * optional callback after completion. |
|---|
| | 3784 | * |
|---|
| | 3785 | * The height, width, and opacity of each of the matched elements |
|---|
| | 3786 | * are changed dynamically according to the specified speed. |
|---|
| | 3787 | * |
|---|
| | 3788 | * @example $("p").show("slow"); |
|---|
| | 3789 | * |
|---|
| | 3790 | * @example $("p").show("slow",function(){ |
|---|
| | 3791 | * alert("Animation Done."); |
|---|
| | 3792 | * }); |
|---|
| | 3793 | * |
|---|
| | 3794 | * @name show |
|---|
| | 3795 | * @type jQuery |
|---|
| | 3796 | * @param String|Number speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000). |
|---|
| | 3797 | * @param Function callback (optional) A function to be executed whenever the animation completes. |
|---|
| | 3798 | * @cat Effects |
|---|
| | 3799 | * @see hide(String|Number,Function) |
|---|
| | 3800 | */ |
|---|
| | 3801 | show: function(speed,callback){ |
|---|
| | 3802 | return speed ? |
|---|
| | 3803 | this.animate({ |
|---|
| | 3804 | height: "show", width: "show", opacity: "show" |
|---|
| | 3805 | }, speed, callback) : |
|---|
| | 3806 | |
|---|
| | 3807 | this.filter(":hidden").each(function(){ |
|---|
| | 3808 | this.style.display = this.oldblock ? this.oldblock : ""; |
|---|
| | 3809 | if ( jQuery.css(this,"display") == "none" ) |
|---|
| | 3810 | this.style.display = "block"; |
|---|
| | 3811 | }).end(); |
|---|
| | 3812 | }, |
|---|
| | 3813 | |
|---|
| | 3814 | /** |
|---|
| | 3815 | * Hides each of the set of matched elements if they are shown. |
|---|
| | 3816 | * |
|---|
| | 3817 | * @example $("p").hide() |
|---|
| | 3818 | * @before <p>Hello</p> |
|---|
| | 3819 | * @result [ <p style="display: none">Hello</p> ] |
|---|
| | 3820 | * |
|---|
| | 3821 | * @name hide |
|---|
| | 3822 | * @type jQuery |
|---|
| | 3823 | * @cat Effects |
|---|
| | 3824 | */ |
|---|
| | 3825 | |
|---|
| | 3826 | /** |
|---|
| | 3827 | * Hide all matched elements using a graceful animation and firing an |
|---|
| | 3828 | * optional callback after completion. |
|---|
| | 3829 | * |
|---|
| | 3830 | * The height, width, and opacity of each of the matched elements |
|---|
| | 3831 | * are changed dynamically according to the specified speed. |
|---|
| | 3832 | * |
|---|
| | 3833 | * @example $("p").hide("slow"); |
|---|
| | 3834 | * |
|---|
| | 3835 | * @example $("p").hide("slow",function(){ |
|---|
| | 3836 | * alert("Animation Done."); |
|---|
| | 3837 | * }); |
|---|
| | 3838 | * |
|---|
| | 3839 | * @name hide |
|---|
| | 3840 | * @type jQuery |
|---|
| | 3841 | * @param String|Number speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000). |
|---|
| | 3842 | * @param Function callback (optional) A function to be executed whenever the animation completes. |
|---|
| | 3843 | * @cat Effects |
|---|
| | 3844 | * @see show(String|Number,Function) |
|---|
| | 3845 | */ |
|---|
| | 3846 | hide: function(speed,callback){ |
|---|
| | 3847 | return speed ? |
|---|
| | 3848 | this.animate({ |
|---|
| | 3849 | height: "hide", width: "hide", opacity: "hide" |
|---|
| | 3850 | }, speed, callback) : |
|---|
| | 3851 | |
|---|
| | 3852 | this.filter(":visible").each(function(){ |
|---|
| | 3853 | this.oldblock = this.oldblock || jQuery.css(this,"display"); |
|---|
| | 3854 | if ( this.oldblock == "none" ) |
|---|
| | 3855 | this.oldblock = "block"; |
|---|
| | 3856 | this.style.display = "none"; |
|---|
| | 3857 | }).end(); |
|---|
| | 3858 | }, |
|---|
| | 3859 | |
|---|
| | 3860 | // Save the old toggle function |
|---|
| | 3861 | _toggle: jQuery.fn.toggle, |
|---|
| | 3862 | |
|---|
| | 3863 | /** |
|---|
| | 3864 | * Toggles each of the set of matched elements. If they are shown, |
|---|
| | 3865 | * toggle makes them hidden. If they are hidden, toggle |
|---|
| | 3866 | * makes them shown. |
|---|
| | 3867 | * |
|---|
| | 3868 | * @example $("p").toggle() |
|---|
| | 3869 | * @before <p>Hello</p><p style="display: none">Hello Again</p> |
|---|
| | 3870 | * @result [ <p style="display: none">Hello</p>, <p style="display: block">Hello Again</p> ] |
|---|
| | 3871 | * |
|---|
| | 3872 | * @name toggle |
|---|
| | 3873 | * @type jQuery |
|---|
| | 3874 | * @cat Effects |
|---|
| | 3875 | */ |
|---|
| | 3876 | toggle: function( fn, fn2 ){ |
|---|
| | 3877 | return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ? |
|---|
| | 3878 | this._toggle( fn, fn2 ) : |
|---|
| | 3879 | this.animate({ |
|---|
| | 3880 | height: "toggle", width: "toggle", opacity: "toggle" |
|---|
| | 3881 | }, fn, fn2); |
|---|
| | 3882 | }, |
|---|
| | 3883 | |
|---|
| | 3884 | /** |
|---|
| | 3885 | * Reveal all matched elements by adjusting their height and firing an |
|---|
| | 3886 | * optional callback after completion. |
|---|
| | 3887 | * |
|---|
| | 3888 | * Only the height is adjusted for this animation, causing all matched |
|---|
| | 3889 | * elements to be revealed in a "sliding" manner. |
|---|
| | 3890 | * |
|---|
| | 3891 | * @example $("p").slideDown("slow"); |
|---|
| | 3892 | * |
|---|
| | 3893 | * @example $("p").slideDown("slow",function(){ |
|---|
| | 3894 | * alert("Animation Done."); |
|---|
| | 3895 | * }); |
|---|
| | 3896 | * |
|---|
| | 3897 | * @name slideDown |
|---|
| | 3898 | * @type jQuery |
|---|
| | 3899 | * @param String|Number speed (optional) A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000). |
|---|
| | 3900 | * @param Function callback (optional) A function to be executed whenever the animation completes. |
|---|
| | 3901 | * @cat Effects |
|---|
| | 3902 | * @see slideUp(String|Number,Function) |
|---|
| | 3903 | * @see slideToggle(String|Number,Function) |
|---|
| | 3904 | */ |
|---|
| | 3905 | slideDown: function(speed,callback){ |
|---|
| | 3906 | return this.animate({height: "show"}, speed, callback); |
|---|
| | 3907 | }, |
|---|
| | 3908 | |
|---|
| | 3909 | /** |
|---|
| | 3910 | * Hide all matched elements by adjusting their height and firing an |
|---|
| | 3911 | * optional callback after completion. |
|---|
| | 3912 | * |
|---|
| | 3913 | * Only the height is adjusted for this animation, causing all matched |
|---|
| | 3914 | * elements to be hidden in a "sliding" manner. |
|---|
| | 3915 | * |
|---|
| | 3916 | * @example $("p").slideUp("slow"); |
|---|
| | 3917 | * |
|---|
| | 3918 | * @example $("p").slideUp("slow",function(){ |
|---|
| | 3919 | * alert("Animation Done."); |
|---|
| | 3920 | * }); |
|---|
| | 3921 | * |
|---|
| | 3922 | * @name slideUp |
|---|
| | 3923 | * @type jQuery |
|---|
| | 3924 | * @param String|Number speed (optional) A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000). |
|---|
| | 3925 | * @param Function callback (optional) A function to be executed whenever the animation completes. |
|---|
| | 3926 | * @cat Effects |
|---|
| | 3927 | * @see slideDown(String|Number,Function) |
|---|
| | 3928 | * @see slideToggle(String|Number,Function) |
|---|
| | 3929 | */ |
|---|
| | 3930 | slideUp: function(speed,callback){ |
|---|
| | 3931 | return this.animate({height: "hide"}, speed, callback); |
|---|
| | 3932 | }, |
|---|
| | 3933 | |
|---|
| | 3934 | /** |
|---|
| | 3935 | * Toggle the visibility of all matched elements by adjusting their height and firing an |
|---|
| | 3936 | * optional callback after completion. |
|---|
| | 3937 | * |
|---|
| | 3938 | * Only the height is adjusted for this animation, causing all matched |
|---|
| | 3939 | * elements to be hidden in a "sliding" manner. |
|---|
| | 3940 | * |
|---|
| | 3941 | * @example $("p").slideToggle("slow"); |
|---|
| | 3942 | * |
|---|
| | 3943 | * @example $("p").slideToggle("slow",function(){ |
|---|
| | 3944 | * alert("Animation Done."); |
|---|
| | 3945 | * }); |
|---|
| | 3946 | * |
|---|
| | 3947 | * @name slideToggle |
|---|
| | 3948 | * @type jQuery |
|---|
| | 3949 | * @param String|Number speed (optional) A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000). |
|---|
| | 3950 | * @param Function callback (optional) A function to be executed whenever the animation completes. |
|---|
| | 3951 | * @cat Effects |
|---|
| | 3952 | * @see slideDown(String|Number,Function) |
|---|
| | 3953 | * @see slideUp(String|Number,Function) |
|---|
| | 3954 | */ |
|---|
| | 3955 | slideToggle: function(speed, callback){ |
|---|
| | 3956 | return this.animate({height: "toggle"}, speed, callback); |
|---|
| | 3957 | }, |
|---|
| | 3958 | |
|---|
| | 3959 | /** |
|---|
| | 3960 | * Fade in all matched elements by adjusting their opacity and firing an |
|---|
| | 3961 | * optional callback after completion. |
|---|
| | 3962 | * |
|---|
| | 3963 | * Only the opacity is adjusted for this animation, meaning that |
|---|
| | 3964 | * all of the matched elements should already have some form of height |
|---|
| | 3965 | * and width associated with them. |
|---|
| | 3966 | * |
|---|
| | 3967 | * @example $("p").fadeIn("slow"); |
|---|
| | 3968 | * |
|---|
| | 3969 | * @example $("p").fadeIn("slow",function(){ |
|---|
| | 3970 | * alert("Animation Done."); |
|---|
| | 3971 | * }); |
|---|
| | 3972 | * |
|---|
| | 3973 | * @name fadeIn |
|---|
| | 3974 | * @type jQuery |
|---|
| | 3975 | * @param String|Number speed (optional) A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000). |
|---|
| | 3976 | * @param Function callback (optional) A function to be executed whenever the animation completes. |
|---|
| | 3977 | * @cat Effects |
|---|
| | 3978 | * @see fadeOut(String|Number,Function) |
|---|
| | 3979 | * @see fadeTo(String|Number,Number,Function) |
|---|
| | 3980 | */ |
|---|
| | 3981 | fadeIn: function(speed, callback){ |
|---|
| | 3982 | return this.animate({opacity: "show"}, speed, callback); |
|---|
| | 3983 | }, |
|---|
| | 3984 | |
|---|
| | 3985 | /** |
|---|
| | 3986 | * Fade out all matched elements by adjusting their opacity and firing an |
|---|
| | 3987 | * optional callback after completion. |
|---|
| | 3988 | * |
|---|
| | 3989 | * Only the opacity is adjusted for this animation, meaning that |
|---|
| | 3990 | * all of the matched elements should already have some form of height |
|---|
| | 3991 | * and width associated with them. |
|---|
| | 3992 | * |
|---|
| | 3993 | * @example $("p").fadeOut("slow"); |
|---|
| | 3994 | * |
|---|
| | 3995 | * @example $("p").fadeOut("slow",function(){ |
|---|
| | 3996 | * alert("Animation Done."); |
|---|
| | 3997 | * }); |
|---|
| | 3998 | * |
|---|
| | 3999 | * @name fadeOut |
|---|
| | 4000 | * @type jQuery |
|---|
| | 4001 | * @param String|Number speed (optional) A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000). |
|---|
| | 4002 | * @param Function callback (optional) A function to be executed whenever the animation completes. |
|---|
| | 4003 | * @cat Effects |
|---|
| | 4004 | * @see fadeIn(String|Number,Function) |
|---|
| | 4005 | * @see fadeTo(String|Number,Number,Function) |
|---|
| | 4006 | */ |
|---|
| | 4007 | fadeOut: function(speed, callback){ |
|---|
| | 4008 | return this.animate({opacity: "hide"}, speed, callback); |
|---|
| | 4009 | }, |
|---|
| | 4010 | |
|---|
| | 4011 | /** |
|---|
| | 4012 | * Fade the opacity of all matched elements to a specified opacity and firing an |
|---|
| | 4013 | * optional callback after completion. |
|---|
| | 4014 | * |
|---|
| | 4015 | * Only the opacity is adjusted for this animation, meaning that |
|---|
| | 4016 | * all of the matched elements should already have some form of height |
|---|
| | 4017 | * and width associated with them. |
|---|
| | 4018 | * |
|---|
| | 4019 | * @example $("p").fadeTo("slow", 0.5); |
|---|
| | 4020 | * |
|---|
| | 4021 | * @example $("p").fadeTo("slow", 0.5, function(){ |
|---|
| | 4022 | * alert("Animation Done."); |
|---|
| | 4023 | * }); |
|---|
| | 4024 | * |
|---|
| | 4025 | * @name fadeTo |
|---|
| | 4026 | * @type jQuery |
|---|
| | 4027 | * @param String|Number speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000). |
|---|
| | 4028 | * @param Number opacity The opacity to fade to (a number from 0 to 1). |
|---|
| | 4029 | * @param Function callback (optional) A function to be executed whenever the animation completes. |
|---|
| | 4030 | * @cat Effects |
|---|
| | 4031 | * @see fadeIn(String|Number,Function) |
|---|
| | 4032 | * @see fadeOut(String|Number,Function) |
|---|
| | 4033 | */ |
|---|
| | 4034 | fadeTo: function(speed,to,callback){ |
|---|
| | 4035 | return this.animate({opacity: to}, speed, callback); |
|---|
| | 4036 | }, |
|---|
| | 4037 | |
|---|
| | 4038 | /** |
|---|
| | 4039 | * A function for making your own, custom animations. The key aspect of |
|---|
| | 4040 | * this function is the object of style properties that will be animated, |
|---|
| | 4041 | * and to what end. Each key within the object represents a style property |
|---|
| | 4042 | * that will also be animated (for example: "height", "top", or "opacity"). |
|---|
| | 4043 | * |
|---|
| | 4044 | * Note that properties should be specified using camel case |
|---|
| | 4045 | * eg. marginLeft instead of margin-left. |
|---|
| | 4046 | * |
|---|
| | 4047 | * The value associated with the key represents to what end the property |
|---|
| | 4048 | * will be animated. If a number is provided as the value, then the style |
|---|
| | 4049 | * property will be transitioned from its current state to that new number. |
|---|
| | 4050 | * Otherwise if the string "hide", "show", or "toggle" is provided, a default |
|---|
| | 4051 | * animation will be constructed for that property. |
|---|
| | 4052 | * |
|---|
| | 4053 | * @example $("p").animate({ |
|---|
| | 4054 | * height: 'toggle', opacity: 'toggle' |
|---|
| | 4055 | * }, "slow"); |
|---|
| | 4056 | * |
|---|
| | 4057 | * @example $("p").animate({ |
|---|
| | 4058 | * left: 50, opacity: 'show' |
|---|
| | 4059 | * }, 500); |
|---|
| | 4060 | * |
|---|
| | 4061 | * @example $("p").animate({ |
|---|
| | 4062 | * opacity: 'show' |
|---|
| | 4063 | * }, "slow", "easein"); |
|---|
| | 4064 | * @desc An example of using an 'easing' function to provide a different style of animation. This will only work if you have a plugin that provides this easing function (Only "swing" and "linear" are provided by default, with jQuery). |
|---|
| | 4065 | * |
|---|
| | 4066 | * @name animate |
|---|
| | 4067 | * @type jQuery |
|---|
| | 4068 | * @param Hash params A set of style attributes that you wish to animate, and to what end. |
|---|
| | 4069 | * @param String|Number speed (optional) A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000). |
|---|
| | 4070 | * @param String easing (optional) The name of the easing effect that you want to use (e.g. "swing" or "linear"). Defaults to "swing". |
|---|
| | 4071 | * @param Function callback (optional) A function to be executed whenever the animation completes. |
|---|
| | 4072 | * @cat Effects |
|---|
| | 4073 | */ |
|---|
| | 4074 | animate: function( prop, speed, easing, callback ) { |
|---|
| | 4075 | return this.queue(function(){ |
|---|
| | 4076 | var hidden = jQuery(this).is(":hidden"); |
|---|
| | 4077 | |
|---|
| | 4078 | for ( var p in prop ) |
|---|
| | 4079 | if ( prop[p] == "hide" && hidden || |
|---|
| | 4080 | prop[p] == "show" && !hidden ) |
|---|
| | 4081 | return; |
|---|
| | 4082 | |
|---|
| | 4083 | this.curAnim = jQuery.extend({}, prop); |
|---|
| | 4084 | var opt = jQuery.speed(speed, easing, callback); |
|---|
| | 4085 | var self = this; |
|---|
| | 4086 | |
|---|
| | 4087 | jQuery.each( prop, function(name, val){ |
|---|
| | 4088 | var e = new jQuery.fx( self, opt, name ); |
|---|
| | 4089 | if ( val.constructor == Number ) |
|---|
| | 4090 | e.custom( e.cur(), val ); |
|---|
| | 4091 | else |
|---|
| | 4092 | e[ val == "toggle" ? hidden ? "show" : "hide" : val ]( prop ); |
|---|
| | 4093 | }); |
|---|
| | 4094 | }); |
|---|
| | 4095 | }, |
|---|
| | 4096 | |
|---|
| | 4097 | /** |
|---|
| | 4098 | * |
|---|
| | 4099 | * @private |
|---|
| | 4100 | */ |
|---|
| | 4101 | queue: function(type,fn){ |
|---|
| | 4102 | if ( !fn ) { |
|---|
| | 4103 | fn = type; |
|---|
| | 4104 | type = "fx"; |
|---|
| | 4105 | } |
|---|
| | 4106 | |
|---|
| | 4107 | return this.each(function(){ |
|---|
| | 4108 | if ( !this.queue ) |
|---|
| | 4109 | this.queue = {}; |
|---|
| | 4110 | |
|---|
| | 4111 | if ( !this.queue[type] ) |
|---|
| | 4112 | this.queue[type] = []; |
|---|
| | 4113 | |
|---|
| | 4114 | this.queue[type].push( fn ); |
|---|
| | 4115 | |
|---|
| | 4116 | if ( this.queue[type].length == 1 ) |
|---|
| | 4117 | fn.apply(this); |
|---|
| | 4118 | }); |
|---|
| | 4119 | } |
|---|
| | 4120 | |
|---|
| | 4121 | }); |
|---|
| | 4122 | |
|---|
| | 4123 | jQuery.extend({ |
|---|
| | 4124 | |
|---|
| | 4125 | speed: function(speed, easing, fn) { |
|---|
| | 4126 | var opt = speed && speed.constructor == Object ? speed : { |
|---|
| | 4127 | complete: fn || !fn && easing || |
|---|
| | 4128 | jQuery.isFunction( speed ) && speed, |
|---|
| | 4129 | duration: speed, |
|---|
| | 4130 | easing: fn && easing || easing && easing.constructor != Function && easing || "swing" |
|---|
| | 4131 | }; |
|---|
| | 4132 | |
|---|
| | 4133 | opt.duration = (opt.duration && opt.duration.constructor == Number ? |
|---|
| | 4134 | opt.duration : |
|---|
| | 4135 | { slow: 600, fast: 200 }[opt.duration]) || 400; |
|---|
| | 4136 | |
|---|
| | 4137 | // Queueing |
|---|
| | 4138 | opt.old = opt.complete; |
|---|
| | 4139 | opt.complete = function(){ |
|---|
| | 4140 | jQuery.dequeue(this, "fx"); |
|---|
| | 4141 | if ( jQuery.isFunction( opt.old ) ) |
|---|
| | 4142 | opt.old.apply( this ); |
|---|
| | 4143 | }; |
|---|
| | 4144 | |
|---|
| | 4145 | return opt; |
|---|
| | 4146 | }, |
|---|
| | 4147 | |
|---|
| | 4148 | easing: { |
|---|
| | 4149 | linear: function( p, n, firstNum, diff ) { |
|---|
| | 4150 | return firstNum + diff * p; |
|---|
| | 4151 | }, |
|---|
| | 4152 | swing: function( p, n, firstNum, diff ) { |
|---|
| | 4153 | return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum; |
|---|
| | 4154 | } |
|---|
| | 4155 | }, |
|---|
| | 4156 | |
|---|
| | 4157 | queue: {}, |
|---|
| | 4158 | |
|---|
| | 4159 | dequeue: function(elem,type){ |
|---|
| | 4160 | type = type || "fx"; |
|---|
| | 4161 | |
|---|
| | 4162 | if ( elem.queue && elem.queue[type] ) { |
|---|
| | 4163 | // Remove self |
|---|
| | 4164 | elem.queue[type].shift(); |
|---|
| | 4165 | |
|---|
| | 4166 | // Get next function |
|---|
| | 4167 | var f = elem.queue[type][0]; |
|---|
| | 4168 | |
|---|
| | 4169 | if ( f ) f.apply( elem ); |
|---|
| | 4170 | } |
|---|
| | 4171 | }, |
|---|
| | 4172 | |
|---|
| | 4173 | timers: [], |
|---|
| | 4174 | |
|---|
| | 4175 | /* |
|---|
| | 4176 | * I originally wrote fx() as a clone of moo.fx and in the process |
|---|
| | 4177 | * of making it small in size the code became illegible to sane |
|---|
| | 4178 | * people. You've been warned. |
|---|
| | 4179 | */ |
|---|
| | 4180 | |
|---|
| | 4181 | fx: function( elem, options, prop ){ |
|---|
| | 4182 | |
|---|
| | 4183 | var z = this; |
|---|
| | 4184 | |
|---|
| | 4185 | // The styles |
|---|
| | 4186 | var y = elem.style; |
|---|
| | 4187 | |
|---|
| | 4188 | if ( prop == "height" || prop == "width" ) { |
|---|
| | 4189 | // Store display property |
|---|
| | 4190 | var oldDisplay = jQuery.css(elem, "display"); |
|---|
| | 4191 | |
|---|
| | 4192 | // Make sure that nothing sneaks out |
|---|
| | 4193 | var oldOverflow = y.overflow; |
|---|
| | 4194 | y.overflow = "hidden"; |
|---|
| | 4195 | } |
|---|
| | 4196 | |
|---|
| | 4197 | // Simple function for setting a style value |
|---|
| | 4198 | z.a = function(){ |
|---|
| | 4199 | if ( options.step ) |
|---|
| | 4200 | options.step.apply( elem, [ z.now ] ); |
|---|
| | 4201 | |
|---|
| | 4202 | if ( prop == "opacity" ) |
|---|
| | 4203 | jQuery.attr(y, "opacity", z.now); // Let attr handle opacity |
|---|
| | 4204 | else { |
|---|
| | 4205 | y[prop] = parseInt(z.now) + "px"; |
|---|
| | 4206 | y.display = "block"; // Set display property to block for animation |
|---|
| | 4207 | } |
|---|
| | 4208 | }; |
|---|
| | 4209 | |
|---|
| | 4210 | // Figure out the maximum number to run to |
|---|
| | 4211 | z.max = function(){ |
|---|
| | 4212 | return parseFloat( jQuery.css(elem,prop) ); |
|---|
| | 4213 | }; |
|---|
| | 4214 | |
|---|
| | 4215 | // Get the current size |
|---|
| | 4216 | z.cur = function(){ |
|---|
| | 4217 | var r = parseFloat( jQuery.curCSS(elem, prop) ); |
|---|
| | 4218 | return r && r > -10000 ? r : z.max(); |
|---|
| | 4219 | }; |
|---|
| | 4220 | |
|---|
| | 4221 | // Start an animation from one number to another |
|---|
| | 4222 | z.custom = function(from,to){ |
|---|
| | 4223 | z.startTime = (new Date()).getTime(); |
|---|
| | 4224 | z.now = from; |
|---|
| | 4225 | z.a(); |
|---|
| | 4226 | |
|---|
| | 4227 | jQuery.timers.push(function(){ |
|---|
| | 4228 | &nb |
|---|