123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870 |
- /* Cases where transition is disabled:
- * - in incompatible browsers (Opera 11 included)
- * - when the animated object is not an element
- * - when there is a special easing
- * - when there is a step function
- * - when jQuery.fx.off is true (should work out of the box)
- *
- * jQuery.fx.stop() will stop animations instead of pausing them (undocumented method and behavior anyway).
- */
- (function( jQuery ) {
- var elemdisplay = {},
- iframe, iframeDoc,
- rfxtypes = /^(?:toggle|show|hide)$/,
- rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,
- //rMarginProp = /^margin/,
- timerId,
- /*fxAttrs = [
- // height animations
- [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],
- // width animations
- [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
- // opacity animations
- [ "opacity" ]
- ],*/
- fxNow;
- // ++TRANSITION++
- // Following feature test code should be moved to support.js
- var div = document.createElement( "div" ),
- divStyle = div.style,
- trans = "Transition",
- _cubicBezier = "cubic-bezier(",
- easingTable;
- // Only test for transition support in Firefox and Webkit
- // as we know for sure that Opera has too much bugs (see http://csstransition.net)
- // and there's no guarantee that first IE implementation will be bug-free
- jQuery.support.transition =
- "Moz" + trans in divStyle ? "Moz" + trans :
- "Webkit" + trans in divStyle ? "Webkit" + trans :
- false;
- // Following declarations should be moved to css.js
- jQuery.cssNumber.color = jQuery.cssNumber.backgroundColor = true;
- // Translation table from "jQuery easings" to "transition timing functions"
- easingTable = {
- linear: "linear",
- swing: "ease-out",
- bounce: _cubicBezier + "0,.35,.5,1.3)",
- // Penner equation approximations from Matthew Lein's Ceaser: http://matthewlein.com/ceaser/
- easeInQuad: _cubicBezier + ".55,.085,.68,.53)",
- easeInCubic: _cubicBezier + ".55,.055,.675,.19)",
- easeInQuart: _cubicBezier + ".895,.03,.685,.22)",
- easeInQuint: _cubicBezier + ".755,.05,.855,.06)",
- easeInSine: _cubicBezier + ".47,0,.745,.715)",
- easeInExpo: _cubicBezier + ".95,.05,.795,.035)",
- easeInCirc: _cubicBezier + ".6,.04,.98,.335)",
- easeOutQuad: _cubicBezier + ".25,.46,.45,.94)",
- easeOutCubic: _cubicBezier + ".215,.61,.355,1)",
- easeOutQuart: _cubicBezier + ".165,.84,.44,1)",
- easeOutQuint: _cubicBezier + ".23,1,.32,1)",
- easeOutSine: _cubicBezier + ".39,.575,.565,1)",
- easeOutExpo: _cubicBezier + ".19,1,.22,1)",
- easeOutCirc: _cubicBezier + ".075,.82,.165,1)",
- easeInOutQuad: _cubicBezier + ".455,.03,.515,.955)",
- easeInOutCubic: _cubicBezier + ".645,.045,.355,1)",
- easeInOutQuart: _cubicBezier + ".77,0,.175,1)",
- easeInOutQuint: _cubicBezier + ".86,0,.07,1)",
- easeInOutSine: _cubicBezier + ".445,.05,.55,.95)",
- easeInOutExpo: _cubicBezier + "1,0,0,1)",
- easeInOutCirc: _cubicBezier + ".785,.135,.15,.86)"
- };
- jQuery.fn.extend({
- /*show: function( speed, easing, callback ) {
- var elem, display;
- if ( speed || speed === 0 ) {
- return this.animate( genFx("show", 3), speed, easing, callback );
- } else {
- for ( var i = 0, j = this.length; i < j; i++ ) {
- elem = this[ i ];
- if ( elem.style ) {
- display = elem.style.display;
- // Reset the inline display of this element to learn if it is
- // being hidden by cascaded rules or not
- if ( !jQuery._data(elem, "olddisplay") && display === "none" ) {
- display = elem.style.display = "";
- }
- // Set elements which have been overridden with display: none
- // in a stylesheet to whatever the default browser style is
- // for such an element
- if ( (display === "" && jQuery.css(elem, "display") === "none") ||
- !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
- jQuery._data( elem, "olddisplay", defaultDisplay(elem.nodeName) );
- }
- }
- }
- // Set the display of most of the elements in a second loop
- // to avoid the constant reflow
- for ( i = 0; i < j; i++ ) {
- elem = this[ i ];
- if ( elem.style ) {
- display = elem.style.display;
- if ( display === "" || display === "none" ) {
- elem.style.display = jQuery._data( elem, "olddisplay" ) || "";
- }
- }
- }
- return this;
- }
- },
- hide: function( speed, easing, callback ) {
- if ( speed || speed === 0 ) {
- return this.animate( genFx("hide", 3), speed, easing, callback);
- } else {
- var elem, display,
- i = 0,
- j = this.length;
- for ( ; i < j; i++ ) {
- elem = this[i];
- if ( elem.style ) {
- display = jQuery.css( elem, "display" );
- if ( display !== "none" && !jQuery._data( elem, "olddisplay" ) ) {
- jQuery._data( elem, "olddisplay", display );
- }
- }
- }
- // Set the display of the elements in a second loop
- // to avoid the constant reflow
- for ( i = 0; i < j; i++ ) {
- if ( this[i].style ) {
- this[i].style.display = "none";
- }
- }
- return this;
- }
- },
- // Save the old toggle function
- _toggle: jQuery.fn.toggle,
- toggle: function( fn, fn2, callback ) {
- var bool = typeof fn === "boolean";
- if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) {
- this._toggle.apply( this, arguments );
- } else if ( fn == null || bool ) {
- this.each(function() {
- var state = bool ? fn : jQuery(this).is(":hidden");
- jQuery(this)[ state ? "show" : "hide" ]();
- });
- } else {
- this.animate(genFx("toggle", 3), fn, fn2, callback);
- }
- return this;
- },
- fadeTo: function( speed, to, easing, callback ) {
- return this.filter(":hidden").css("opacity", 0).show().end()
- .animate({opacity: to}, speed, easing, callback);
- },*/
- animate: function( prop, speed, easing, callback ) {
- var optall = jQuery.speed( speed, easing, callback );
- if ( jQuery.isEmptyObject( prop ) ) {
- return this.each( optall.complete, [ false ] );
- }
- // Do not change referenced properties as per-property easing will be lost
- prop = jQuery.extend( {}, prop );
- function doAnimation() {
- // XXX 'this' does not always have a nodeName when running the
- // test suite
- if ( optall.queue === false ) {
- jQuery._mark( this );
- }
- var opt = jQuery.extend( {}, optall ),
- isElement = this.nodeType === 1,
- hidden = isElement && jQuery(this).is(":hidden"),
- name, val, p, e, hooks, replace,
- parts, start, end, unit,
- method,
- // ++TRANSITION++
- cssProps = jQuery.cssProps,
- // disable transition if a step option is supplied
- supportTransition = !opt.step && jQuery.support.transition,
- transition,
- transitions = [],
- easing, real, lower,
- computedStyle;
- // will store per property easing and be used to determine when an animation is complete
- opt.animatedProperties = {};
- // ++TRANSITION++
- // transition is enabled per property, when:
- // - there is no step function for the animation
- // - there is no special easing for the property
- opt.transition = {};
- // first pass over propertys to expand / normalize
- for ( p in prop ) {
- name = jQuery.camelCase( p );
- if ( p !== name ) {
- prop[ name ] = prop[ p ];
- delete prop[ p ];
- }
- if ( ( hooks = jQuery.cssHooks[ name ] ) && "expand" in hooks ) {
- replace = hooks.expand( prop[ name ] );
- delete prop[ name ];
- // not quite $.extend, this wont overwrite keys already present.
- // also - reusing 'p' from above because we have the correct "name"
- for ( p in replace ) {
- if ( ! ( p in prop ) ) {
- prop[ p ] = replace[ p ];
- }
- }
- }
- }
- for ( name in prop ) {
- val = prop[ name ];
- // easing resolution: per property > opt.specialEasing > opt.easing > 'swing' (default)
- if ( jQuery.isArray( val ) ) {
- /* ++TRANSITION++ */ easing = opt.animatedProperties[ name ] = val[ 1 ];
- val = prop[ name ] = val[ 0 ];
- } else {
- /* ++TRANSITION++ */ easing = opt.animatedProperties[ name ] = opt.specialEasing && opt.specialEasing[ name ] || opt.easing || "swing";
- }
- // ++TRANSITION++
- // check that CSS Transitions can be used
- transition = supportTransition && isElement && opt.duration > 0 && name.indexOf( "scroll" ) && easingTable[ easing ];
- // collect the properties to be added to elem.style.transition...
- if ( transition ) {
- real = cssProps[ name ] || name;
- lower = real.replace(/([A-Z])/g, '-$1').toLowerCase();
- transition =
- lower +" "+
- opt.duration +"ms "+
- transition;
- opt.transition[ name ] = {
- lower: lower,
- real: real
- };
- transitions.push(transition);
- }
- if ( val === "hide" && hidden || val === "show" && !hidden ) {
- return opt.complete.call( this );
- }
- if ( isElement && ( name === "height" || name === "width" ) ) {
- // Make sure that nothing sneaks out
- // Record all 3 overflow attributes because IE does not
- // change the overflow attribute when overflowX and
- // overflowY are set to the same value
- opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ];
- // Set display property to inline-block for height/width
- // animations on inline elements that are having width/height animated
- if ( jQuery.css( this, "display" ) === "inline" &&
- jQuery.css( this, "float" ) === "none" ) {
- // inline-level elements accept inline-block;
- // block-level elements need to be inline with layout
- if ( !jQuery.support.inlineBlockNeedsLayout || defaultDisplay( this.nodeName ) === "inline" ) {
- this.style.display = "inline-block";
- } else {
- this.style.zoom = 1;
- }
- }
- }
- }
- if ( opt.overflow != null ) {
- this.style.overflow = "hidden";
- }
- for ( p in prop ) {
- e = new jQuery.fx( this, opt, p );
- val = prop[ p ];
- if ( rfxtypes.test( val ) ) {
- // Tracks whether to show or hide based on private
- // data attached to the element
- method = jQuery._data( this, "toggle" + p ) || ( val === "toggle" ? hidden ? "show" : "hide" : 0 );
- if ( method ) {
- jQuery._data( this, "toggle" + p, method === "show" ? "hide" : "show" );
- e[ method ]();
- } else {
- e[ val ]();
- }
- } else {
- parts = rfxnum.exec( val );
- start = e.cur();
- if ( parts ) {
- end = parseFloat( parts[2] );
- unit = parts[3] || ( jQuery.cssNumber[ p ] ? "" : "px" );
- // We need to compute starting value
- if ( unit !== "px" && p !== "opacity" ) {
- jQuery.style( this, p, (end || 1) + unit);
- start = ( (end || 1) / e.cur() ) * start;
- jQuery.style( this, p, start + unit);
- }
- // If a +=/-= token was provided, we're doing a relative animation
- if ( parts[1] ) {
- end = ( (parts[ 1 ] === "-=" ? -1 : 1) * end ) + start;
- }
- e.custom( start, end, unit );
- } else {
- e.custom( start, val, "" );
- }
- }
- }
- // ++TRANSITION++
- if ( supportTransition && transitions.length ) {
- transition = this.style[supportTransition];
- computedStyle = window.getComputedStyle( this );
- this.style[ supportTransition ] =
- transitions.join() + ( transition && transition.indexOf( "none" ) ? "," + transition : "" );
- // Once the transition property has been set, it's time to set all animated style properties
- for ( p in opt.transition ) {
- // access the computed style to make sure it has been taken into account by the browser
- computedStyle[ p ];
- // ...before setting the target style
- jQuery.style.apply( null, opt.transition[ p ].styleToSet );
- }
- }
- // For JS strict compliance
- return true;
- }
- return optall.queue === false ?
- this.each( doAnimation ) :
- this.queue( optall.queue, doAnimation );
- },
- stop: function( type, clearQueue, gotoEnd ) {
- if ( typeof type !== "string" ) {
- gotoEnd = clearQueue;
- clearQueue = type;
- type = undefined;
- }
- if ( clearQueue && type !== false ) {
- this.queue( type || "fx", [] );
- }
- return this.each(function() {
- var index,
- hadTimers = false,
- timers = jQuery.timers,
- data = jQuery._data( this ),
- // ++TRANSITION++
- supportTransition = jQuery.support.transition;
- // clear marker counters if we know they won't be
- if ( !gotoEnd ) {
- jQuery._unmark( true, this );
- }
- function stopQueue( elem, data, index ) {
- var hooks = data[ index ];
- jQuery.removeData( elem, index, true );
- hooks.stop( gotoEnd );
- }
- if ( type == null ) {
- for ( index in data ) {
- if ( data[ index ] && data[ index ].stop && index.indexOf(".run") === index.length - 4 ) {
- stopQueue( this, data, index );
- }
- }
- } else if ( data[ index = type + ".run" ] && data[ index ].stop ){
- stopQueue( this, data, index );
- }
- for ( index = timers.length; index--; ) {
- // ++TRANSITION++
- if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
- if ( gotoEnd || supportTransition ) {
- // force the next step to be the last
- timers[ index ]( /* ++TRANSITION++*/ gotoEnd );
- }
- if ( !gotoEnd ) {
- timers[ index ].saveState();
- }
- hadTimers = true;
- timers.splice( index, 1 );
- }
- }
- // start the next in the queue if the last step wasn't forced
- // timers currently will call their complete callbacks, which will dequeue
- // but only if they were gotoEnd
- if ( !( gotoEnd && hadTimers ) ) {
- jQuery.dequeue( this, type );
- }
- });
- }
- });
- // Animations created synchronously will run synchronously
- function createFxNow() {
- setTimeout( clearFxNow, 0 );
- return ( fxNow = jQuery.now() );
- }
- function clearFxNow() {
- fxNow = undefined;
- }
- /*// Generate parameters to create a standard animation
- function genFx( type, num ) {
- var obj = {};
- jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice( 0, num )), function() {
- obj[ this ] = type;
- });
- return obj;
- }
- // Generate shortcuts for custom animations
- jQuery.each({
- slideDown: genFx( "show", 1 ),
- slideUp: genFx( "hide", 1 ),
- slideToggle: genFx( "toggle", 1 ),
- fadeIn: { opacity: "show" },
- fadeOut: { opacity: "hide" },
- fadeToggle: { opacity: "toggle" }
- }, function( name, props ) {
- jQuery.fn[ name ] = function( speed, easing, callback ) {
- return this.animate( props, speed, easing, callback );
- };
- });
- jQuery.extend({
- speed: function( speed, easing, fn ) {
- var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
- complete: fn || !fn && easing ||
- jQuery.isFunction( speed ) && speed,
- duration: speed,
- easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
- };
- opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
- opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
- // normalize opt.queue - true/undefined/null -> "fx"
- if ( opt.queue == null || opt.queue === true ) {
- opt.queue = "fx";
- }
- // Queueing
- opt.old = opt.complete;
- opt.complete = function( noUnmark ) {
- if ( jQuery.isFunction( opt.old ) ) {
- opt.old.call( this );
- }
- if ( opt.queue ) {
- jQuery.dequeue( this, opt.queue );
- } else if ( noUnmark !== false ) {
- jQuery._unmark( this );
- }
- };
- return opt;
- },
- easing: {
- linear: function( p ) {
- return p;
- },
- swing: function( p ) {
- return ( -Math.cos( p*Math.PI ) / 2 ) + 0.5;
- }
- },
- timers: [],
- fx: function( elem, options, prop ) {
- this.options = options;
- this.elem = elem;
- this.prop = prop;
- options.orig = options.orig || {};
- }
- });*/
- jQuery.extend( jQuery.fx.prototype, {
- /*jQuery.fx.prototype = {
- // Simple function for setting a style value
- update: function() {
- if ( this.options.step ) {
- this.options.step.call( this.elem, this.now, this );
- }
- ( jQuery.fx.step[ this.prop ] || jQuery.fx.step._default )( this );
- },*/
- // Get the current size
- cur: function() {
- if ( this.elem[ this.prop ] != null && (!this.elem.style || this.elem.style[ this.prop ] == null) ) {
- return this.elem[ this.prop ];
- }
- var parsed,
- r = jQuery.css( this.elem, this.prop );
- // Empty strings, null, undefined and "auto" are converted to 0,
- // complex values such as "rotate(1rad)" are returned as is,
- // simple values such as "10px" are parsed to Float.
- return isNaN( parsed = parseFloat( r ) ) ? !r || r === "auto" ? 0 : r : parsed;
- },
- // Start an animation from one number to another
- custom: function( from, to, unit ) {
- var self = this,
- fx = jQuery.fx,
- // ++TRANSITION++
- transition = self.options.transition,
- // prop has to be saved, or it'll be undefined in the setTimeout closure
- prop = this.prop;
- this.startTime = fxNow || createFxNow();
- this.end = to;
- this.now = this.start = from;
- this.pos = this.state = 0;
- this.unit = unit || this.unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
- function t( gotoEnd ) {
- return self.step( gotoEnd );
- }
- t.queue = this.options.queue;
- t.elem = this.elem;
- t.saveState = function() {
- if ( jQuery._data( self.elem, "fxshow" + self.prop ) === undefined ) {
- if ( self.options.hide ) {
- jQuery._data( self.elem, "fxshow" + self.prop, self.start );
- } else if ( self.options.show ) {
- jQuery._data( self.elem, "fxshow" + self.prop, self.end );
- }
- }
- };
- // ++TRANSITION++
- if ( ( t.transition = transition[ prop ] ) ) {
- jQuery.timers.push( t );
- // explicitly set the property to it's initial value to workaround bugzil.la/571344
- // transform shouldn't cause any problem in this case, as it is covered by the spec.
- if ( prop != "transform" ) {
- self.elem.style[ transition[ prop ].real ] = from + self.unit;
- }
- // prevent negative values on certain properties
- jQuery.fx.step[ prop ] && ( to = Math.max(0, to) );
- transition[ prop ].styleToSet = [ self.elem, prop, to + self.unit ];
- // use a setTimeout to detect the end of a transition
- // the transitionend event is unreliable
- transition[ prop ].timeout = setTimeout(function() {
- jQuery.timers.splice( jQuery.timers.indexOf( t ), 1 );
- self.step( true );
- // add an unperceptible delay to help some tests pass in Firefox
- }, self.options.duration + 30);
- } else if ( t() && jQuery.timers.push(t) && !timerId ) {
- timerId = setInterval( fx.tick, fx.interval );
- }
- },
- /*// Simple 'show' function
- show: function() {
- var dataShow = jQuery._data( this.elem, "fxshow" + this.prop );
- // Remember where we started, so that we can go back to it later
- this.options.orig[ this.prop ] = dataShow || jQuery.style( this.elem, this.prop );
- this.options.show = true;
- // Begin the animation
- // Make sure that we start at a small width/height to avoid any flash of content
- if ( dataShow !== undefined ) {
- // This show is picking up where a previous hide or show left off
- this.custom( this.cur(), dataShow );
- } else {
- this.custom( this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur() );
- }
- // Start by showing the element
- jQuery( this.elem ).show();
- },
- // Simple 'hide' function
- hide: function() {
- // Remember where we started, so that we can go back to it later
- this.options.orig[ this.prop ] = jQuery._data( this.elem, "fxshow" + this.prop ) || jQuery.style( this.elem, this.prop );
- this.options.hide = true;
- // Begin the animation
- this.custom( this.cur(), 0 );
- },*/
- // Each step of an animation
- step: function( gotoEnd ) {
- var p, n, complete,
- t = fxNow || createFxNow(),
- done = true,
- elem = this.elem,
- options = this.options,
- // ++TRANSITION++
- transition = options.transition[ this.prop ],
- naturalEnd = t >= options.duration + this.startTime,
- supportTransition = jQuery.support.transition;
- if ( transition || gotoEnd || naturalEnd ) {
- if ( !transition ) {
- this.now = this.end;
- this.pos = this.state = 1;
- this.update();
- // ++TRANSITION++
- } else {
- clearTimeout( transition.timeout );
- // Stop a transition halfway through
- if ( !gotoEnd && !naturalEnd ) {
- // yes, stopping a transition halfway through should be as simple as setting a property to its current value.
- // Try to call window.getComputedStyle() only once per element (in tick()?)
- this.elem.style[ transition.real ] = jQuery.css( this.elem, transition.real );
- }
- }
- options.animatedProperties[ this.prop ] = true;
- for ( p in options.animatedProperties ) {
- if ( options.animatedProperties[ p ] !== true ) {
- done = false;
- }
- }
- if ( done ) {
- // Reset the overflow
- if ( options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {
- jQuery.each( [ "", "X", "Y" ], function( index, value ) {
- elem.style[ "overflow" + value ] = options.overflow[ index ];
- });
- }
- // Hide the element if the "hide" operation was done
- if ( options.hide ) {
- jQuery( elem ).hide();
- }
- // ++TRANSITION++
- // cleanup the transition property
- if ( transition ) {
- transition = "," + elem.style[ supportTransition ];
- for ( p in options.transition ) {
- transition = transition.split( options.transition[ p ].lower ).join("_");
- }
- transition = transition.replace( /, ?_[^,]*/g, "" ).substr(1);
- // if the resulting string is empty, replace it with "none" to achieve gotoEnd
- elem.style[ supportTransition ] = transition || "none";
- // finish on an empty string if "none" has been used
- // this way transitions set with CSS aren't overridden.
- !transition && ( elem.style[ supportTransition ] = transition );
- }
- // Reset the properties, if the item has been hidden or shown
- if ( options.hide || options.show ) {
- for ( p in options.animatedProperties ) {
- ( gotoEnd || naturalEnd ) && jQuery.style( elem, p, options.orig[ p ] );
- jQuery.removeData( elem, "fxshow" + p, true );
- // Toggle data is no longer needed
- jQuery.removeData( elem, "toggle" + p, true );
- }
- }
- // Execute the complete function
- // in the event that the complete function throws an exception
- // we must ensure it won't be called twice. #5684
- complete = options.complete;
- if ( complete && ( gotoEnd || naturalEnd ) ) {
- options.complete = false;
- complete.call( elem );
- }
- }
- return false;
- } else {
- // classical easing cannot be used with an Infinity duration
- if ( options.duration == Infinity ) {
- this.now = t;
- } else {
- n = t - this.startTime;
- this.state = n / options.duration;
- // Perform the easing function, defaults to swing
- this.pos = jQuery.easing[ options.animatedProperties[this.prop] ]( this.state, n, 0, 1, options.duration );
- this.now = this.start + ( (this.end - this.start) * this.pos );
- }
- // Perform the next step of the animation
- this.update();
- }
- return true;
- }
- });//};
- jQuery.extend( jQuery.fx, {
- tick: function() {
- var timer,
- timers = jQuery.timers,
- i = 0;
- for ( ; i < timers.length; i++ ) {
- timer = timers[ i ];
- // Checks the timer has not already been removed
- // ++TRANSITION++
- if ( !timer.transition && !timer() && timers[ i ] === timer ) {
- timers.splice( i--, 1 );
- }
- }
- if ( !timers.length ) {
- jQuery.fx.stop();
- }
- }/*,
- interval: 13,
- stop: function() {
- clearInterval( timerId );
- timerId = null;
- },
- speeds: {
- slow: 600,
- fast: 200,
- // Default speed
- _default: 400
- },
- step: {
- opacity: function( fx ) {
- jQuery.style( fx.elem, "opacity", fx.now );
- },
- _default: function( fx ) {
- if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) {
- fx.elem.style[ fx.prop ] = fx.now + fx.unit;
- } else {
- fx.elem[ fx.prop ] = fx.now;
- }
- }
- }*/
- });
- /*// Ensure props that can't be negative don't go there on undershoot easing
- jQuery.each( fxAttrs.concat.apply( [], fxAttrs ), function( i, prop ) {
- // Exclude marginTop, marginLeft, marginBottom and marginRight from this list
- if ( !rMarginProp.test( prop ) ) {
- jQuery.fx.step[ prop ] = function( fx ) {
- jQuery.style( fx.elem, prop, Math.max(0, fx.now) + fx.unit );
- };
- }
- });
- if ( jQuery.expr && jQuery.expr.filters ) {
- jQuery.expr.filters.animated = function( elem ) {
- return jQuery.grep(jQuery.timers, function( fn ) {
- return elem === fn.elem;
- }).length;
- };
- }*/
- // Try to restore the default display value of an element
- function defaultDisplay( nodeName ) {
- if ( !elemdisplay[ nodeName ] ) {
- var body = document.body,
- elem = jQuery( "<" + nodeName + ">" ).appendTo( body ),
- display = elem.css( "display" );
- elem.remove();
- // If the simple way fails,
- // get element's real default display by attaching it to a temp iframe
- if ( display === "none" || display === "" ) {
- // No iframe to use yet, so create it
- if ( !iframe ) {
- iframe = document.createElement( "iframe" );
- iframe.frameBorder = iframe.width = iframe.height = 0;
- }
- body.appendChild( iframe );
- // Create a cacheable copy of the iframe document on first call.
- // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML
- // document to it; WebKit & Firefox won't allow reusing the iframe document.
- if ( !iframeDoc || !iframe.createElement ) {
- iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;
- iframeDoc.write( ( jQuery.support.boxModel ? "<!doctype html>" : "" ) + "<html><body>" );
- iframeDoc.close();
- }
- elem = iframeDoc.createElement( nodeName );
- iframeDoc.body.appendChild( elem );
- display = jQuery.css( elem, "display" );
- body.removeChild( iframe );
- }
- // Store the correct default display
- elemdisplay[ nodeName ] = display;
- }
- return elemdisplay[ nodeName ];
- }
- })( jQuery );
|