From 292fb28ec1942c76759885a5999ccf680cbcfa4b Mon Sep 17 00:00:00 2001 From: Cezary Date: Fri, 15 Nov 2013 12:25:58 +0100 Subject: [PATCH 1/2] issue fix #135 fadeIn() breaks initial opacity value --- scripts/src/jquery.animate-enhanced.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/src/jquery.animate-enhanced.js b/scripts/src/jquery.animate-enhanced.js index 90229ef..9871911 100644 --- a/scripts/src/jquery.animate-enhanced.js +++ b/scripts/src/jquery.animate-enhanced.js @@ -335,7 +335,8 @@ Changelog: // deal with shortcuts if (!parts && val == 'show') { - cleanStart = 1; + var defaultOpacity = e.css('opacity'); + cleanStart = typeof defaultOpacity === 'undefined' || parseFloat(defaultOpacity) === 0 ? 1 : defaultOpacity; if (hidden) e.css({'display': _domElementVisibleDisplayValue(e.context.tagName), 'opacity': 0}); } else if (!parts && val == "hide") { cleanStart = 0; From c5244b6e6d61575f0af38a47c362e1a31f310beb Mon Sep 17 00:00:00 2001 From: Cezary Date: Fri, 15 Nov 2013 18:45:51 +0100 Subject: [PATCH 2/2] default jQuery easing function instead of hardcoded 'swing' --- scripts/src/jquery.animate-enhanced.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/src/jquery.animate-enhanced.js b/scripts/src/jquery.animate-enhanced.js index 9871911..48affca 100644 --- a/scripts/src/jquery.animate-enhanced.js +++ b/scripts/src/jquery.animate-enhanced.js @@ -674,6 +674,7 @@ Changelog: return this[ optall.queue === true ? 'queue' : 'each' ](function() { var self = jQuery(this), opt = jQuery.extend({}, optall), + defEasing = jQuery.easing.def, cssCallback = function(e) { var selfCSSData = self.data(DATA_KEY) || { original: {} }, restore = {}; @@ -741,7 +742,7 @@ Changelog: easeInOutBack: CUBIC_BEZIER_OPEN + '0.680, -0.550, 0.265, 1.550' + CUBIC_BEZIER_CLOSE }, domProperties = {}, - cssEasing = easings[opt.easing || 'swing'] ? easings[opt.easing || 'swing'] : opt.easing || 'swing'; + cssEasing = easings[opt.easing || defEasing] ? easings[opt.easing || defEasing] : opt.easing || defEasing; // seperate out the properties for the relevant animation functions for (var p in prop) { @@ -796,7 +797,7 @@ Changelog: callbackQueue++; originalAnimateMethod.apply(self, [domProperties, { duration: opt.duration, - easing: jQuery.easing[opt.easing] ? opt.easing : (jQuery.easing.swing ? 'swing' : 'linear'), + easing: jQuery.easing[opt.easing] ? opt.easing : defEasing, complete: propertyCallback, queue: opt.queue }]);