Skip to content

Commit

Permalink
Display toggling fix
Browse files Browse the repository at this point in the history
To have display set to an auto value, pass in “auto” instead of empty
quotes (“”).
  • Loading branch information
julianshapiro committed Jul 10, 2014
1 parent 160e12d commit ed5a9c3
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 14 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "velocity",
"version": "0.5.0",
"version": "0.5.2",
"homepage": "http://velocityjs.org",
"authors": [
{ "name" : "Julian Shapiro",
Expand Down
2 changes: 1 addition & 1 deletion component.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "velocity",
"repository": "julianshapiro/velocity",
"version": "0.5.0",
"version": "0.5.2",
"description": "Accelerated JavaScript animation.",
"keywords": [
"animation",
Expand Down
14 changes: 9 additions & 5 deletions jquery.velocity.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

/*!
* Velocity.js: Accelerated JavaScript animation.
* @version 0.5.0
* @version 0.5.2
* @docs http://velocityjs.org
* @license Copyright 2014 Julian Shapiro. MIT License: http://en.wikipedia.org/wiki/MIT_License
*/
Expand Down Expand Up @@ -241,7 +241,7 @@ Velocity's structure:
animate: function () { /* Defined below. */ },
/* Set to true to force a duration of 1ms for all animations so that UI testing can be performed without waiting on animations to complete. */
mock: false,
version: { major: 0, minor: 5, patch: 0 },
version: { major: 0, minor: 5, patch: 2 },
/* Set to 1 or 2 (most verbose) to output debug info to console. */
debug: false
};
Expand Down Expand Up @@ -1877,6 +1877,10 @@ Velocity's structure:
/* Refer to Velocity's documentation (VelocityJS.org/#display) for a description of the display option's behavior. */
if (opts.display) {
opts.display = opts.display.toString().toLowerCase();

if (opts.display === "auto") {
opts.display = Velocity.CSS.Values.getDisplayType(element);
}
}

/**********************
Expand Down Expand Up @@ -3142,7 +3146,7 @@ Velocity's structure:
if (direction === "Down") {
/* All sliding elements are set to the "block" display value (as opposed to an element-appropriate block/inline distinction)
because inline elements cannot actually have their dimensions modified. */
opts.display = opts.display || Velocity.CSS.Values.getDisplayType(element);
opts.display = opts.display || "auto";
} else {
opts.display = opts.display || "none";
}
Expand Down Expand Up @@ -3256,8 +3260,8 @@ Velocity's structure:
/* If a display was passed in, use it. Otherwise, default to "none" for fadeOut or the element-specific default for fadeIn. */
/* Note: We allow users to pass in "null" to skip display setting altogether. */
if (opts.display !== null) {
opts.display = (direction === "In") ? Velocity.CSS.Values.getDisplayType(element) : "none";
//opts.display = opts.display || ((direction === "In") ? Velocity.CSS.Values.getDisplayType(element) : "none");
opts.display = (direction === "In") ? "auto" : "none";
//opts.display = opts.display || ((direction === "In") ? "auto" : "none");
}

Velocity.animate(this, propertiesMap, opts);
Expand Down
4 changes: 2 additions & 2 deletions jquery.velocity.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "velocity-animate",
"version": "0.5.0",
"version": "0.5.2",
"description": "Accelerated JavaScript animation.",
"keywords": [
"velocity",
Expand Down
8 changes: 4 additions & 4 deletions velocity.ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

/*!
* velocity.ui.js: UI effects pack for Velocity. Load this file after jquery.velocity.js.
* @version 4.0.1
* @version 4.0.3
* @docs http://velocityjs.org/#uiPack
* @support <=IE8: Callouts will have no effect, and transitions will simply fade in/out. IE9/Android 2.3: Most effects are fully supported, the rest fade in/out. All other browsers: Full support.
* @license Copyright Julian Shapiro. MIT License: http://en.wikipedia.org/wiki/MIT_License
Expand All @@ -26,8 +26,8 @@
return;
}

if (!Container.Velocity.version) {
var abortError = "Velocity UI Pack: You need to update your jquery.velocity.js to a newer version. Visit http://github.com/julianshapiro/velocity.";
if (!Container.Velocity.version || (Container.Velocity.version.major <= 0 && Container.Velocity.version.minor <= 5 && Container.Velocity.version.patch <= 1)) {
var abortError = "Velocity UI Pack: You need to update Velocity (jquery.velocity.js) to a newer version. Visit http://github.com/julianshapiro/velocity.";

alert(abortError);
throw new Error(abortError);
Expand Down Expand Up @@ -112,7 +112,7 @@
if (sequenceOptions.display && sequenceOptions.display !== "none") {
opts.display = sequenceOptions.display;
} else if (/In$/.test(effectName)) {
opts.display = Container.Velocity.CSS.Values.getDisplayType(element);
opts.display = "auto";
}
}
}
Expand Down

0 comments on commit ed5a9c3

Please sign in to comment.