mirror of
https://github.com/wekan/wekan.git
synced 2025-12-17 07:50:12 +01:00
Improve popup animation
When going back wait for the popup transition to end before removing the DOM element.
This commit is contained in:
parent
d81cad4251
commit
6ef9c7e95f
3 changed files with 27 additions and 3 deletions
|
|
@ -1,3 +1,12 @@
|
||||||
|
// XXX This event list should be abstracted somewhere else.
|
||||||
|
var endTransitionEvents = [
|
||||||
|
'webkitTransitionEnd',
|
||||||
|
'otransitionend',
|
||||||
|
'oTransitionEnd',
|
||||||
|
'msTransitionEnd',
|
||||||
|
'transitionend'
|
||||||
|
].join(' ');
|
||||||
|
|
||||||
Popup.template.events({
|
Popup.template.events({
|
||||||
click: function(evt) {
|
click: function(evt) {
|
||||||
if (evt.originalEvent) {
|
if (evt.originalEvent) {
|
||||||
|
|
@ -14,3 +23,18 @@ Popup.template.events({
|
||||||
this.__afterConfirmAction.call(this);
|
this.__afterConfirmAction.call(this);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// When a popup content is removed (ie, when the user press the "back" button),
|
||||||
|
// we need to wait for the container translation to end before removing the
|
||||||
|
// actual DOM element. For that purpose we use the undocumented `_uihooks` API.
|
||||||
|
Popup.template.onRendered(function() {
|
||||||
|
var container = this.find('.content-container');
|
||||||
|
container._uihooks = {
|
||||||
|
removeElement: function(node) {
|
||||||
|
$(node).addClass('no-height');
|
||||||
|
$(container).one(endTransitionEvents, function() {
|
||||||
|
node.parentNode.removeChild(node);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@
|
||||||
width: 100%
|
width: 100%
|
||||||
|
|
||||||
.content-container
|
.content-container
|
||||||
width: 1000px
|
width: 5000px
|
||||||
max-height: 550px
|
max-height: 550px
|
||||||
transition: transform 0.2s
|
transition: transform 0.2s
|
||||||
|
|
||||||
|
|
@ -104,7 +104,7 @@
|
||||||
padding: 0 10px 10px
|
padding: 0 10px 10px
|
||||||
float: left
|
float: left
|
||||||
|
|
||||||
&.is-hidden
|
&.no-height
|
||||||
height: 0
|
height: 0
|
||||||
|
|
||||||
.quiet
|
.quiet
|
||||||
|
|
|
||||||
|
|
@ -17,5 +17,5 @@
|
||||||
//-
|
//-
|
||||||
XXX We need a better way to express the "is the last element" condition.
|
XXX We need a better way to express the "is the last element" condition.
|
||||||
Hopefully the @last helper will come soon (or at least @index)
|
Hopefully the @last helper will come soon (or at least @index)
|
||||||
.content(class="{{#unless $eq popupName ../popupName}}is-hidden{{/unless}}")
|
.content(class="{{#unless $eq popupName ../popupName}}no-height{{/unless}}")
|
||||||
+Template.dynamic(template=popupName data=dataContext)
|
+Template.dynamic(template=popupName data=dataContext)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue