From 2ea0d4a87489efd57a30f8a04b660fe1fc7701da Mon Sep 17 00:00:00 2001 From: RaNaN Date: Fri, 28 Dec 2012 19:57:11 +0100 Subject: added animate-enhanced --- module/web/static/js/utils/animations.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'module/web/static/js/utils/animations.js') diff --git a/module/web/static/js/utils/animations.js b/module/web/static/js/utils/animations.js index 18360c526..2840bba66 100644 --- a/module/web/static/js/utils/animations.js +++ b/module/web/static/js/utils/animations.js @@ -62,13 +62,14 @@ define(['jquery', 'underscore', 'transit'], function(jQuery, _) { jQuery.fn._transit = jQuery.fn.transit; // Overriding transit plugin to support hide and show - // Props retains it properties across multiple calls, therefore props.show value is introduced jQuery.fn.transit = jQuery.fn.transition = function(props, duration, easing, callback) { var self = this; var cb = callback; - if (props && (props.opacity === 'hide' || (props.opacity === 0 && props.show === true))) { - props.opacity = 0; - props.show = true; + var newprops = _.extend({}, props); + console.log(newprops); + + if (newprops && (newprops.opacity === 'hide')) { + newprops.opacity = 0; callback = function() { self.css({display: 'none'}); @@ -76,12 +77,11 @@ define(['jquery', 'underscore', 'transit'], function(jQuery, _) { cb.apply(self); } }; - } else if (props && (props.opacity === 'show' || (props.opacity === 1 && props.show === true))) { - props.opacity = 1; - props.show = true; + } else if (newprops && (newprops.opacity === 'show')) { + newprops.opacity = 1; this.css({display: 'block'}); } - return this._transit(props, duration, easing, callback); + return this._transit(newprops, duration, easing, callback); }; }); \ No newline at end of file -- cgit v1.2.3