fix: description cuted button on top of the description container and smarter cut
This commit is contained in:
parent
10b3b74e78
commit
841a8610b1
5 changed files with 43 additions and 9 deletions
|
|
@ -25,22 +25,27 @@ document.querySelectorAll('.schedule-category').forEach(node => {
|
|||
*/
|
||||
let description = document.querySelector('.description-cutted')
|
||||
let descriptionActions = document.querySelector('.description-actions-container')
|
||||
|
||||
let descriptionOpened = false
|
||||
let defaultMaxHeight = ""
|
||||
if (description !== null) {
|
||||
let btn = document.querySelector('.description-btn')
|
||||
let btnIcon = document.getElementById('description-btn-icon')
|
||||
let btnText = document.getElementById('description-btn-text')
|
||||
btn.onclick = () => {
|
||||
if (!descriptionOpened) {
|
||||
// open the full description
|
||||
descriptionActions.className = descriptionActions.className.replace(' closed', '')
|
||||
defaultMaxHeight = description.style.maxHeight
|
||||
description.style.maxHeight = description.scrollHeight + "px"
|
||||
btn.textContent = "Fermer la description"
|
||||
btnText.textContent = "Fermer la description"
|
||||
btnIcon.style.transform = 'rotate(180deg)'
|
||||
} else {
|
||||
// initial max Height
|
||||
descriptionActions.className += ' closed'
|
||||
description.style.maxHeight = defaultMaxHeight
|
||||
btn.textContent = "Ouvrir la description"
|
||||
btnText.textContent = "Ouvrir la description"
|
||||
btnIcon.style.transform = 'rotate(0deg)'
|
||||
}
|
||||
descriptionOpened = !descriptionOpened
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue