Add CSS animation for node-children collapse/expand
This commit is contained in:
parent
89abc7e7af
commit
e0fbd06e10
2 changed files with 24 additions and 0 deletions
|
|
@ -452,6 +452,17 @@ form.node-action {
|
|||
}
|
||||
}
|
||||
|
||||
/* Node children collapse/expand animation */
|
||||
[id^="node-children-"] {
|
||||
overflow: hidden;
|
||||
max-height: 10000px;
|
||||
transition: max-height 0.8s ease-out;
|
||||
}
|
||||
|
||||
[id^="node-children-"].toggle-collapsed {
|
||||
max-height: 0;
|
||||
}
|
||||
|
||||
.my-namespaces-div {
|
||||
display: none;
|
||||
position: absolute;
|
||||
|
|
|
|||
|
|
@ -46,6 +46,19 @@ function toggle(target, button, off_text, on_text) {
|
|||
if (typeof on_text === 'undefined') on_text = 'hide';
|
||||
var el = document.getElementById(target);
|
||||
var btn = document.getElementById(button);
|
||||
|
||||
// Handle node-children collapse (visible by default, toggle to hide)
|
||||
if (target.indexOf('node-children-') === 0) {
|
||||
if (el.classList.contains('toggle-collapsed')) {
|
||||
el.classList.remove('toggle-collapsed');
|
||||
btn.textContent = on_text;
|
||||
} else {
|
||||
el.classList.add('toggle-collapsed');
|
||||
btn.textContent = off_text;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (el.classList.contains('toggle-open')) {
|
||||
// Animate close, then update text
|
||||
el.classList.add('toggle-closing');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue