angelovcom.net

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

effect-clip.js (1525B)


      1 /*!
      2  * jQuery UI Effects Clip 1.12.1
      3  * http://jqueryui.com
      4  *
      5  * Copyright jQuery Foundation and other contributors
      6  * Released under the MIT license.
      7  * http://jquery.org/license
      8  */
      9 
     10 //>>label: Clip Effect
     11 //>>group: Effects
     12 //>>description: Clips the element on and off like an old TV.
     13 //>>docs: http://api.jqueryui.com/clip-effect/
     14 //>>demos: http://jqueryui.com/effect/
     15 
     16 ( function( factory ) {
     17 	if ( typeof define === "function" && define.amd ) {
     18 
     19 		// AMD. Register as an anonymous module.
     20 		define( [
     21 			"jquery",
     22 			"./effect"
     23 		], factory );
     24 	} else {
     25 
     26 		// Browser globals
     27 		factory( jQuery );
     28 	}
     29 }( function( $ ) {
     30 
     31 return $.effects.define( "clip", "hide", function( options, done ) {
     32 	var start,
     33 		animate = {},
     34 		element = $( this ),
     35 		direction = options.direction || "vertical",
     36 		both = direction === "both",
     37 		horizontal = both || direction === "horizontal",
     38 		vertical = both || direction === "vertical";
     39 
     40 	start = element.cssClip();
     41 	animate.clip = {
     42 		top: vertical ? ( start.bottom - start.top ) / 2 : start.top,
     43 		right: horizontal ? ( start.right - start.left ) / 2 : start.right,
     44 		bottom: vertical ? ( start.bottom - start.top ) / 2 : start.bottom,
     45 		left: horizontal ? ( start.right - start.left ) / 2 : start.left
     46 	};
     47 
     48 	$.effects.createPlaceholder( element );
     49 
     50 	if ( options.mode === "show" ) {
     51 		element.cssClip( animate.clip );
     52 		animate.clip = start;
     53 	}
     54 
     55 	element.animate( animate, {
     56 		queue: false,
     57 		duration: options.duration,
     58 		easing: options.easing,
     59 		complete: done
     60 	} );
     61 
     62 } );
     63 
     64 } ) );