dist/garnish.js
function(elem, prop) {
        var $elem = $(elem);

        if (!prop) {
            prop = 'margin-left';
        }

        var startingPoint = parseInt($elem.css(prop));
        if (isNaN(startingPoint)) {
            startingPoint = 0;
        }

        for (var i = 0; i <= Garnish.SHAKE_STEPS; i++) {
            (function(i) {
                setTimeout(function() {
                    Garnish.shake._properties = {};
                    Garnish.shake._properties[prop] = startingPoint + (i % 2 ? -1 : 1) * (10 - i);
                    $elem.velocity(Garnish.shake._properties, Garnish.SHAKE_STEP_DURATION);
                }, (Garnish.SHAKE_STEP_DURATION * i));
            })(i);
        }
    }
function(elem, prop) {
        var $elem = $(elem);

        if (!prop) {
            prop = 'margin-left';
        }

        var startingPoint = parseInt($elem.css(prop));
        if (isNaN(startingPoint)) {
            startingPoint = 0;
        }

        for (var i = 0; i <= Garnish.SHAKE_STEPS; i++) {
            (function(i) {
                setTimeout(function() {
                    Garnish.shake._properties = {};
                    Garnish.shake._properties[prop] = startingPoint + (i % 2 ? -1 : 1) * (10 - i);
                    $elem.velocity(Garnish.shake._properties, Garnish.SHAKE_STEP_DURATION);
                }, (Garnish.SHAKE_STEP_DURATION * i));
            })(i);
        }
    }
function ( elem , prop ) { var $elem = $ ( elem ) ; if ( ! prop ) { prop = 'margin-left' ; } var startingPoint = parseInt ( $elem . css ( prop ) ) ; if ( isNaN ( startingPoint ) ) { startingPoint = 0 ; } for ( var i = 0 ; i <= Garnish . SHAKE_STEPS ; i ++ ) { ( function ( i ) { setTimeout ( function ( ) { Garnish . shake . _properties = { } ; Garnish . shake . _properties [ prop ] = startingPoint + ( i % 2 ? - 1 : 1 ) * ( 10 - i ) ; $elem . velocity ( Garnish . shake . _properties , Garnish . SHAKE_STEP_DURATION ) ; } , ( Garnish . SHAKE_STEP_DURATION * i ) ) ; } ) ( i ) ; } }
Shakes an element.

@param {object}  elem Either an actual element or a jQuery collection.
@param {string} prop The property that should be adjusted (default is 'margin-left').
Shakes an element .