[ Index ] |
PHP Cross Reference of MediaWiki-1.24.0 |
[Summary view] [Print] [Text view]
1 /*! 2 * jQuery UI Effects Shake 1.9.2 3 * http://jqueryui.com 4 * 5 * Copyright 2012 jQuery Foundation and other contributors 6 * Released under the MIT license. 7 * http://jquery.org/license 8 * 9 * http://api.jqueryui.com/shake-effect/ 10 * 11 * Depends: 12 * jquery.ui.effect.js 13 */ 14 (function( $, undefined ) { 15 16 $.effects.effect.shake = function( o, done ) { 17 18 var el = $( this ), 19 props = [ "position", "top", "bottom", "left", "right", "height", "width" ], 20 mode = $.effects.setMode( el, o.mode || "effect" ), 21 direction = o.direction || "left", 22 distance = o.distance || 20, 23 times = o.times || 3, 24 anims = times * 2 + 1, 25 speed = Math.round(o.duration/anims), 26 ref = (direction === "up" || direction === "down") ? "top" : "left", 27 positiveMotion = (direction === "up" || direction === "left"), 28 animation = {}, 29 animation1 = {}, 30 animation2 = {}, 31 i, 32 33 // we will need to re-assemble the queue to stack our animations in place 34 queue = el.queue(), 35 queuelen = queue.length; 36 37 $.effects.save( el, props ); 38 el.show(); 39 $.effects.createWrapper( el ); 40 41 // Animation 42 animation[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance; 43 animation1[ ref ] = ( positiveMotion ? "+=" : "-=" ) + distance * 2; 44 animation2[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance * 2; 45 46 // Animate 47 el.animate( animation, speed, o.easing ); 48 49 // Shakes 50 for ( i = 1; i < times; i++ ) { 51 el.animate( animation1, speed, o.easing ).animate( animation2, speed, o.easing ); 52 } 53 el 54 .animate( animation1, speed, o.easing ) 55 .animate( animation, speed / 2, o.easing ) 56 .queue(function() { 57 if ( mode === "hide" ) { 58 el.hide(); 59 } 60 $.effects.restore( el, props ); 61 $.effects.removeWrapper( el ); 62 done(); 63 }); 64 65 // inject all the animations we just queued to be first in line (after "inprogress") 66 if ( queuelen > 1) { 67 queue.splice.apply( queue, 68 [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) ); 69 } 70 el.dequeue(); 71 72 }; 73 74 })(jQuery);
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 14:03:12 2014 | Cross-referenced by PHPXref 0.7.1 |