src/main/java/com/gitblit/wicket/pages/scripts/imgdiff.js
/**
	 * Moves the slider to the given ratio, clipped to [0..1], in duration milliseconds.
	 * Generates slider:pos events during the animation. If duration <= 30, same as setTo.
	 * Default duration is 500ms. If a callback is given, it's called once the animation
	 * has completed.
	 */
Moves the slider to the given ratio, clipped to [0..1], in duration milliseconds.
Generates slider:pos events during the animation. If duration <= 30, same as setTo.
Default duration is 500ms. If a callback is given, it's called once the animation
has completed.
Moves the slider to the given ratio clipped to [ 0 .. 1 ] in duration milliseconds . Generates slider : pos events during the animation . If duration < = 30 same as setTo . Default duration is 500ms . If a callback is given it ' s called once the animation has completed .
function moveTo(ratio, duration, callback) {
		ratio = Math.min(1.0, Math.max(0, ratio));
		if (ratio === lastRatio) {
			if (typeof callback == 'function') callback();
			return;
		}
		if (typeof duration == 'undefined') duration = 500;
		if (duration <= 30) {
			setTo(ratio);
			if (typeof callback == 'function') callback();
		} else {
			var target = ratio * ($elem.innerWidth() - $handle.outerWidth(false));
			if (ratio > lastRatio) target--; else target++;
			$handle.stop().animate({left: target},
				{ 'duration' : duration,
				  'step' : function() {
						lastRatio = Math.min(1.0, Math.max(0, $handle.position().left / ($elem.innerWidth() - $handle.outerWidth(false))));
						$elem.trigger('slider:pos', { ratio : lastRatio, handle : $handle[0] });
					},
				  'complete' : function() { setTo(ratio); if (typeof callback == 'function') callback(); } 
				}
			);
		}
	}
function moveTo ( ratio , duration , callback ) { ratio = Math . min ( 1.0 , Math . max ( 0 , ratio ) ) ; if ( ratio === lastRatio ) { if ( typeof callback == 'function' ) callback ( ) ; return ; } if ( typeof duration == 'undefined' ) duration = 500 ; if ( duration <= 30 ) { setTo ( ratio ) ; if ( typeof callback == 'function' ) callback ( ) ; } else { var target = ratio * ( $elem . innerWidth ( ) - $handle . outerWidth ( false ) ) ; if ( ratio > lastRatio ) target -- ; else target ++ ; $handle . stop ( ) . animate ( { left : target } , { 'duration' : duration , 'step' : function ( ) { lastRatio = Math . min ( 1.0 , Math . max ( 0 , $handle . position ( ) . left / ( $elem . innerWidth ( ) - $handle . outerWidth ( false ) ) ) ) ; $elem . trigger ( 'slider:pos' , { ratio : lastRatio , handle : $handle [ 0 ] } ) ; } , 'complete' : function ( ) { setTo ( ratio ) ; if ( typeof callback == 'function' ) callback ( ) ; } } ) ; } }
Moves the slider to the given ratio, clipped to [0..1], in duration milliseconds.
Moves the slider to the given ratio clipped to [ 0 .. 1 ] in duration milliseconds .
// Cinema is 24 or 48 frames/sec, so 20-40ms per frame. Makes no sense to animate for such a short duration. // Ensure we have again a % value