fix: bugs
This commit is contained in:
parent
2f9872dc8e
commit
2590fa9e64
4 changed files with 18 additions and 8 deletions
|
@ -1,6 +1,16 @@
|
|||
window.onload = () => {
|
||||
const button = document.querySelector('[data-toggle-button]')
|
||||
const content = document.querySelector('[data-toggle-content]')
|
||||
const text = document.querySelectorAll('[data-toggle-content] p')
|
||||
const minHeight = 500 // this needs to match the height set on [data-toggle-content].text-toggle-hidden in text-toggle.css
|
||||
let interiorHeight = 0
|
||||
|
||||
text.forEach(node => interiorHeight += node.scrollHeight)
|
||||
|
||||
if (interiorHeight < minHeight) {
|
||||
content.classList.remove('text-toggle-hidden')
|
||||
button.style.display = 'none'
|
||||
}
|
||||
|
||||
button.addEventListener('click', () => {
|
||||
if (content.classList.contains('text-toggle-hidden')) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[data-toggle-content].text-toggle-hidden {
|
||||
position: relative;
|
||||
height: calc(var(--sizing-3xl) * 5);
|
||||
height: 500px;
|
||||
overflow: hidden;
|
||||
margin-bottom: var(--sizing-base);
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
|||
content: '';
|
||||
top: 0;
|
||||
left: 0;
|
||||
box-shadow: inset 0 -100px 50px -60px var(--background-color);
|
||||
box-shadow: inset 0 -120px 50px -60px var(--background-color);
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
|
Reference in a new issue