From a370d1ffc8b0783a3a9ed1951e144902baddb264 Mon Sep 17 00:00:00 2001 From: gnarf Date: Wed, 2 Mar 2011 20:00:57 -0600 Subject: Just a quick touch to update to new internal effects object API --- ui/jquery.effects.clip.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'ui/jquery.effects.clip.js') diff --git a/ui/jquery.effects.clip.js b/ui/jquery.effects.clip.js index c0fe450c9..9c29d252d 100644 --- a/ui/jquery.effects.clip.js +++ b/ui/jquery.effects.clip.js @@ -17,11 +17,10 @@ $.effects.clip = function(o) { return this.queue(function() { // Create element - var el = $(this), props = ['position','top','bottom','left','right','height','width']; - - // Set options - var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode - var direction = o.options.direction || 'vertical'; // Default direction + var el = $( this ), + props = ['position','top','bottom','left','right','height','width'], + mode = $.effects.setMode( el, o.mode || 'hide' ), + direction = o.direction || 'vertical'; // Default direction // Adjust $.effects.save(el, props); el.show(); // Save & Show @@ -40,10 +39,10 @@ $.effects.clip = function(o) { animation[ref.position] = mode == 'show' ? 0 : distance / 2; // Animate - animate.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() { + animate.animate(animation, { queue: false, duration: o.duration, easing: o.easing, complete: function() { if(mode == 'hide') el.hide(); // Hide $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore - if(o.callback) o.callback.apply(el[0], arguments); // Callback + if(o.complete) o.complete.apply(el[0], arguments); // Callback el.dequeue(); }}); -- cgit v1.2.3 From 210fcc427819140795e71392d07bbdd836eee2bb Mon Sep 17 00:00:00 2001 From: gnarf Date: Sun, 6 Mar 2011 05:22:32 -0600 Subject: effects.clip: Style Guidance --- ui/jquery.effects.clip.js | 66 +++++++++++++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 25 deletions(-) (limited to 'ui/jquery.effects.clip.js') diff --git a/ui/jquery.effects.clip.js b/ui/jquery.effects.clip.js index 9c29d252d..643e436b1 100644 --- a/ui/jquery.effects.clip.js +++ b/ui/jquery.effects.clip.js @@ -12,39 +12,55 @@ */ (function( $, undefined ) { -$.effects.clip = function(o) { +$.effects.clip = function( o ) { - return this.queue(function() { + return this.queue( function() { // Create element var el = $( this ), props = ['position','top','bottom','left','right','height','width'], mode = $.effects.setMode( el, o.mode || 'hide' ), - direction = o.direction || 'vertical'; // Default direction - - // Adjust - $.effects.save(el, props); el.show(); // Save & Show - var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper - var animate = el[0].tagName == 'IMG' ? wrapper : el; - var ref = { - size: (direction == 'vertical') ? 'height' : 'width', - position: (direction == 'vertical') ? 'top' : 'left' - }; - var distance = (direction == 'vertical') ? animate.height() : animate.width(); - if(mode == 'show') { animate.css(ref.size, 0); animate.css(ref.position, distance / 2); } // Shift - - // Animation - var animation = {}; - animation[ref.size] = mode == 'show' ? distance : 0; - animation[ref.position] = mode == 'show' ? 0 : distance / 2; + direction = o.direction || 'vertical', + ref = { + size: (direction == 'vertical') ? 'height' : 'width', + position: (direction == 'vertical') ? 'top' : 'left' + }, + animation = {}, + wrapper, animate, distance; + + // Save & Show + $.effects.save( el, props ); el.show(); + + // Create Wrapper + wrapper = $.effects.createWrapper( el ).css({ + overflow: 'hidden' + }); + animate = ( el[0].tagName == 'IMG' ) ? wrapper : el; + distance = ( direction == 'vertical' ) ? animate.height() : animate.width(); + + // Shift + if ( mode == 'show' ) { + animate.css( ref.size, 0 ); + animate.css( ref.position, distance / 2 ); + } + + // Create Animation Object: + animation[ ref.size ] = mode == 'show' ? distance : 0; + animation[ ref.position ] = mode == 'show' ? 0 : distance / 2; // Animate - animate.animate(animation, { queue: false, duration: o.duration, easing: o.easing, complete: function() { - if(mode == 'hide') el.hide(); // Hide - $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore - if(o.complete) o.complete.apply(el[0], arguments); // Callback - el.dequeue(); - }}); + animate.animate( animation, { + queue: false, + duration: o.duration, + easing: o.easing, + complete: function() { + mode == 'hide' && el.hide(); + $.effects.restore( el, props ); + $.effects.removeWrapper( el ); + $.isFunction( o.complete ) && o.complete.apply( el[ 0 ], arguments ); + el.dequeue(); + } + }); }); -- cgit v1.2.3 From 7391fe8df3ce335f467989a69151636c8bed17bc Mon Sep 17 00:00:00 2001 From: gnarf Date: Sun, 6 Mar 2011 05:25:38 -0600 Subject: effects.clip: Reuse a var instead of calculate again --- ui/jquery.effects.clip.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui/jquery.effects.clip.js') diff --git a/ui/jquery.effects.clip.js b/ui/jquery.effects.clip.js index 643e436b1..8cf91da57 100644 --- a/ui/jquery.effects.clip.js +++ b/ui/jquery.effects.clip.js @@ -36,7 +36,7 @@ $.effects.clip = function( o ) { overflow: 'hidden' }); animate = ( el[0].tagName == 'IMG' ) ? wrapper : el; - distance = ( direction == 'vertical' ) ? animate.height() : animate.width(); + distance = animate[ ref.size ](); // Shift if ( mode == 'show' ) { -- cgit v1.2.3