mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-11-06 10:33:00 +00:00
Improvements to slide animation
This commit is contained in:
@@ -29,7 +29,8 @@ function slideOpen(domNode,options) {
|
|||||||
{marginTop: ""},
|
{marginTop: ""},
|
||||||
{paddingBottom: ""},
|
{paddingBottom: ""},
|
||||||
{paddingTop: ""},
|
{paddingTop: ""},
|
||||||
{height: "auto"}
|
{height: "auto"},
|
||||||
|
{opacity: ""}
|
||||||
]);
|
]);
|
||||||
domNode.removeEventListener(transitionEventName,handler,false);
|
domNode.removeEventListener(transitionEventName,handler,false);
|
||||||
if(options.callback) {
|
if(options.callback) {
|
||||||
@@ -43,7 +44,8 @@ function slideOpen(domNode,options) {
|
|||||||
{marginBottom: "0px"},
|
{marginBottom: "0px"},
|
||||||
{paddingTop: "0px"},
|
{paddingTop: "0px"},
|
||||||
{paddingBottom: "0px"},
|
{paddingBottom: "0px"},
|
||||||
{height: "0px"}
|
{height: "0px"},
|
||||||
|
{opacity: "0"}
|
||||||
]);
|
]);
|
||||||
$tw.utils.forceLayout(domNode);
|
$tw.utils.forceLayout(domNode);
|
||||||
// Transition to the final position
|
// Transition to the final position
|
||||||
@@ -52,12 +54,14 @@ function slideOpen(domNode,options) {
|
|||||||
"margin-bottom " + $tw.config.preferences.animationDurationMs + " ease-in-out, " +
|
"margin-bottom " + $tw.config.preferences.animationDurationMs + " ease-in-out, " +
|
||||||
"padding-top " + $tw.config.preferences.animationDurationMs + " ease-in-out, " +
|
"padding-top " + $tw.config.preferences.animationDurationMs + " ease-in-out, " +
|
||||||
"padding-bottom " + $tw.config.preferences.animationDurationMs + " ease-in-out, " +
|
"padding-bottom " + $tw.config.preferences.animationDurationMs + " ease-in-out, " +
|
||||||
"height " + $tw.config.preferences.animationDurationMs + " ease-in-out"},
|
"height " + $tw.config.preferences.animationDurationMs + " ease-in-out, " +
|
||||||
|
"opacity " + $tw.config.preferences.animationDurationMs + " ease-in-out"},
|
||||||
{marginBottom: currMarginBottom + "px"},
|
{marginBottom: currMarginBottom + "px"},
|
||||||
{marginTop: currMarginTop + "px"},
|
{marginTop: currMarginTop + "px"},
|
||||||
{paddingBottom: currPaddingBottom + "px"},
|
{paddingBottom: currPaddingBottom + "px"},
|
||||||
{paddingTop: currPaddingTop + "px"},
|
{paddingTop: currPaddingTop + "px"},
|
||||||
{height: currHeight + "px"}
|
{height: currHeight + "px"},
|
||||||
|
{opacity: "1"}
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,7 +76,8 @@ function slideClosed(domNode,options) {
|
|||||||
{marginTop: ""},
|
{marginTop: ""},
|
||||||
{paddingBottom: ""},
|
{paddingBottom: ""},
|
||||||
{paddingTop: ""},
|
{paddingTop: ""},
|
||||||
{height: "auto"}
|
{height: "auto"},
|
||||||
|
{opacity: ""}
|
||||||
]);
|
]);
|
||||||
domNode.removeEventListener(transitionEventName,handler,false);
|
domNode.removeEventListener(transitionEventName,handler,false);
|
||||||
if(options.callback) {
|
if(options.callback) {
|
||||||
@@ -81,7 +86,8 @@ function slideClosed(domNode,options) {
|
|||||||
},false);
|
},false);
|
||||||
// Set up the initial position of the element
|
// Set up the initial position of the element
|
||||||
$tw.utils.setStyle(domNode,[
|
$tw.utils.setStyle(domNode,[
|
||||||
{height: currHeight + "px"}
|
{height: currHeight + "px"},
|
||||||
|
{opacity: "1"}
|
||||||
]);
|
]);
|
||||||
$tw.utils.forceLayout(domNode);
|
$tw.utils.forceLayout(domNode);
|
||||||
// Transition to the final position
|
// Transition to the final position
|
||||||
@@ -90,12 +96,14 @@ function slideClosed(domNode,options) {
|
|||||||
"margin-bottom " + $tw.config.preferences.animationDurationMs + " ease-in-out, " +
|
"margin-bottom " + $tw.config.preferences.animationDurationMs + " ease-in-out, " +
|
||||||
"padding-top " + $tw.config.preferences.animationDurationMs + " ease-in-out, " +
|
"padding-top " + $tw.config.preferences.animationDurationMs + " ease-in-out, " +
|
||||||
"padding-bottom " + $tw.config.preferences.animationDurationMs + " ease-in-out, " +
|
"padding-bottom " + $tw.config.preferences.animationDurationMs + " ease-in-out, " +
|
||||||
"height " + $tw.config.preferences.animationDurationMs + " ease-in-out"},
|
"height " + $tw.config.preferences.animationDurationMs + " ease-in-out, " +
|
||||||
|
"opacity " + $tw.config.preferences.animationDurationMs + " ease-in-out"},
|
||||||
{marginTop: "0px"},
|
{marginTop: "0px"},
|
||||||
{marginBottom: "0px"},
|
{marginBottom: "0px"},
|
||||||
{paddingTop: "0px"},
|
{paddingTop: "0px"},
|
||||||
{paddingBottom: "0px"},
|
{paddingBottom: "0px"},
|
||||||
{height: "0px"}
|
{height: "0px"},
|
||||||
|
{opacity: "0"}
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ RevealWidget.prototype.generate = function() {
|
|||||||
this["default"] = this.renderer.getAttribute("default");
|
this["default"] = this.renderer.getAttribute("default");
|
||||||
this.qualifyTiddlerTitles = this.renderer.getAttribute("qualifyTiddlerTitles");
|
this.qualifyTiddlerTitles = this.renderer.getAttribute("qualifyTiddlerTitles");
|
||||||
this["class"] = this.renderer.getAttribute("class");
|
this["class"] = this.renderer.getAttribute("class");
|
||||||
|
this.animate = this.renderer.getAttribute("animate","no");
|
||||||
// Compute the title of the state tiddler and read it
|
// Compute the title of the state tiddler and read it
|
||||||
this.stateTitle = this.state;
|
this.stateTitle = this.state;
|
||||||
if(this.qualifyTiddlerTitles) {
|
if(this.qualifyTiddlerTitles) {
|
||||||
@@ -151,13 +152,17 @@ RevealWidget.prototype.refreshInDom = function(changedAttributes,changedTiddlers
|
|||||||
}
|
}
|
||||||
// Animate the opening or closing
|
// Animate the opening or closing
|
||||||
if(this.isOpen !== previousState) {
|
if(this.isOpen !== previousState) {
|
||||||
if(this.isOpen) {
|
if(this.animate !== "no") {
|
||||||
this.renderer.domNode.style.display = this.renderer.parseTreeNode.isBlock ? "block" : "inline";
|
if(this.isOpen) {
|
||||||
$tw.anim.perform("open",this.renderer.domNode);
|
this.renderer.domNode.style.display = this.renderer.parseTreeNode.isBlock ? "block" : "inline";
|
||||||
|
$tw.anim.perform("open",this.renderer.domNode);
|
||||||
|
} else {
|
||||||
|
$tw.anim.perform("close",this.renderer.domNode,{callback: function() {
|
||||||
|
self.renderer.domNode.style.display = "none";
|
||||||
|
}});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$tw.anim.perform("close",this.renderer.domNode,{callback: function() {
|
this.renderer.domNode.style.display = this.isOpen ? (this.renderer.parseTreeNode.isBlock ? "block" : "inline") : "none";
|
||||||
self.renderer.domNode.style.display = "none";
|
|
||||||
}});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Add or remove the tw-reveal-open class
|
// Add or remove the tw-reveal-open class
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ modifier: JeremyRuston
|
|||||||
|
|
||||||
</span><$view field="title"/></span>
|
</span><$view field="title"/></span>
|
||||||
|
|
||||||
<$reveal type="nomatch" text="" default="" state="$:/state/tiddlerInfo" qualifyTiddlerTitles="yes" class="tw-tiddler-info">
|
<$reveal type="nomatch" text="" default="" state="$:/state/tiddlerInfo" qualifyTiddlerTitles="yes" class="tw-tiddler-info" animate="yes">
|
||||||
|
|
||||||
<$transclude template="$:/templates/TiddlerInfo"/>
|
<$transclude template="$:/templates/TiddlerInfo"/>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user