mirror of
https://github.com/morris/vanilla-todo.git
synced 2025-08-18 11:51:20 +02:00
fix issues with custom list height calc
This commit is contained in:
@@ -3,11 +3,15 @@ export function AppCollapsible(el) {
|
|||||||
show: true,
|
show: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
el.addEventListener('collapse', (e) => update({ show: !e.detail }));
|
setTimeout(() => el.classList.add('-animated'), 200);
|
||||||
|
|
||||||
el.querySelector('.bar > .toggle').addEventListener('click', () =>
|
el.addEventListener('collapse', (e) => {
|
||||||
update({ show: !state.show }),
|
update({ show: typeof e.detail === 'boolean' ? !e.detail : state.show });
|
||||||
);
|
});
|
||||||
|
|
||||||
|
el.querySelector('.bar > .toggle').addEventListener('click', () => {
|
||||||
|
update({ show: !state.show });
|
||||||
|
});
|
||||||
|
|
||||||
update();
|
update();
|
||||||
|
|
||||||
|
@@ -33,7 +33,7 @@ export function TodoApp(el) {
|
|||||||
</div>
|
</div>
|
||||||
<footer class="app-footer">
|
<footer class="app-footer">
|
||||||
<p>
|
<p>
|
||||||
VANILLA TODO © 2020-2022 <a href="https://morrisbrodersen.de">Morris Brodersen</a>
|
VANILLA TODO © 2020–2023 <a href="https://morrisbrodersen.de">Morris Brodersen</a>
|
||||||
— A case study on viable techniques for vanilla web development.
|
— A case study on viable techniques for vanilla web development.
|
||||||
<a href="https://github.com/morris/vanilla-todo">About →</a>
|
<a href="https://github.com/morris/vanilla-todo">About →</a>
|
||||||
</p>
|
</p>
|
||||||
@@ -113,7 +113,7 @@ export function TodoApp(el) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
el.querySelectorAll('.app-collapsible').forEach((el) =>
|
el.querySelectorAll('.app-collapsible').forEach((el) =>
|
||||||
el.dispatchEvent(new CustomEvent('collapse', { detail: false })),
|
el.dispatchEvent(new CustomEvent('collapse')),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -118,14 +118,18 @@ export function TodoFrameCustom(el) {
|
|||||||
const container = el.querySelector('.container');
|
const container = el.querySelector('.container');
|
||||||
|
|
||||||
for (let i = 0, l = container.children.length; i < l; ++i) {
|
for (let i = 0, l = container.children.length; i < l; ++i) {
|
||||||
|
container.children[i].style.height = `auto`;
|
||||||
height = Math.max(container.children[i].offsetHeight, height);
|
height = Math.max(container.children[i].offsetHeight, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
el.style.height = `${height + 50}px`;
|
el.style.height = `${height + 80}px`;
|
||||||
|
|
||||||
for (let i = 0, l = container.children.length; i < l; ++i) {
|
for (let i = 0, l = container.children.length; i < l; ++i) {
|
||||||
container.children[i].style.height = `${height}px`;
|
container.children[i].style.height = `${height + 30}px`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// update collapsible on changing heights
|
||||||
|
el.dispatchEvent(new CustomEvent('collapse', { bubbles: true }));
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLists() {
|
function getLists() {
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
background: #fff;
|
background: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.app-collapsible > .body {
|
.app-collapsible.-animated > .body {
|
||||||
transition: height 0.2s ease-out;
|
transition: height 0.2s ease-out;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user