Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $.fn.shake = function( options ) {
- var config = $.extend( {
- 'times': 3,
- 'width': 50,
- 'speed': 100
- }, options);
- var defaults = $.extend(defaults, config);
- return this.each(function() {
- $(this).css('position', 'relative');
- for( i=0; i<=config.times; i++ )
- {
- $(this).animate({
- 'left': ( i%2 == 0 ) ? -config.width : Math.abs(config.width)
- }, config.speed);
- }
- $(this).animate({
- 'left': 0
- }, config.speed, function(){
- $(this).removeAttr('style');
- });
- });
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement