diff options
author | Filipp Lepalaan <f@230.to> | 2014-02-19 18:02:09 +0200 |
---|---|---|
committer | Filipp Lepalaan <f@230.to> | 2014-02-19 18:02:09 +0200 |
commit | 75ad7e4bd7d69243e7e5281c2642f00478fb072d (patch) | |
tree | eaaaf360902d369f42d94778aac8803db7973ce0 /apps/it/static/js/ui/ui/jquery.ui.effect-shake.js | |
parent | cfc7c3f52544af8a71d3fa3988a06fee200d2c24 (diff) | |
download | pudding-75ad7e4bd7d69243e7e5281c2642f00478fb072d.tar.gz pudding-75ad7e4bd7d69243e7e5281c2642f00478fb072d.tar.bz2 pudding-75ad7e4bd7d69243e7e5281c2642f00478fb072d.zip |
Added tags, jquery UI
Diffstat (limited to 'apps/it/static/js/ui/ui/jquery.ui.effect-shake.js')
-rw-r--r-- | apps/it/static/js/ui/ui/jquery.ui.effect-shake.js | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/apps/it/static/js/ui/ui/jquery.ui.effect-shake.js b/apps/it/static/js/ui/ui/jquery.ui.effect-shake.js new file mode 100644 index 0000000..218a69f --- /dev/null +++ b/apps/it/static/js/ui/ui/jquery.ui.effect-shake.js @@ -0,0 +1,74 @@ +/*! + * jQuery UI Effects Shake 1.10.4 + * http://jqueryui.com + * + * Copyright 2014 jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + * + * http://api.jqueryui.com/shake-effect/ + * + * Depends: + * jquery.ui.effect.js + */ +(function( $, undefined ) { + +$.effects.effect.shake = function( o, done ) { + + var el = $( this ), + props = [ "position", "top", "bottom", "left", "right", "height", "width" ], + mode = $.effects.setMode( el, o.mode || "effect" ), + direction = o.direction || "left", + distance = o.distance || 20, + times = o.times || 3, + anims = times * 2 + 1, + speed = Math.round(o.duration/anims), + ref = (direction === "up" || direction === "down") ? "top" : "left", + positiveMotion = (direction === "up" || direction === "left"), + animation = {}, + animation1 = {}, + animation2 = {}, + i, + + // we will need to re-assemble the queue to stack our animations in place + queue = el.queue(), + queuelen = queue.length; + + $.effects.save( el, props ); + el.show(); + $.effects.createWrapper( el ); + + // Animation + animation[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance; + animation1[ ref ] = ( positiveMotion ? "+=" : "-=" ) + distance * 2; + animation2[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance * 2; + + // Animate + el.animate( animation, speed, o.easing ); + + // Shakes + for ( i = 1; i < times; i++ ) { + el.animate( animation1, speed, o.easing ).animate( animation2, speed, o.easing ); + } + el + .animate( animation1, speed, o.easing ) + .animate( animation, speed / 2, o.easing ) + .queue(function() { + if ( mode === "hide" ) { + el.hide(); + } + $.effects.restore( el, props ); + $.effects.removeWrapper( el ); + done(); + }); + + // inject all the animations we just queued to be first in line (after "inprogress") + if ( queuelen > 1) { + queue.splice.apply( queue, + [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) ); + } + el.dequeue(); + +}; + +})(jQuery); |