mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
Refactoring dropdown.vue so that dropdownMobile calls openDropdown and closeDropdown
This commit is contained in:
@@ -811,9 +811,7 @@ export default {
|
||||
}
|
||||
},
|
||||
dropdownMobile (click) {
|
||||
this.dropdown(click.currentTarget.parentElement);
|
||||
},
|
||||
dropdown (element) {
|
||||
const element = click.currentTarget.parentElement;
|
||||
const droppedElement = document.getElementsByClassName('down')[0];
|
||||
if (droppedElement && droppedElement !== element) {
|
||||
droppedElement.classList.remove('down');
|
||||
@@ -821,9 +819,11 @@ export default {
|
||||
droppedElement.lastChild.style.maxHeight = 0;
|
||||
}
|
||||
}
|
||||
|
||||
element.classList.toggle('down');
|
||||
element.lastChild.style.maxHeight = element.classList.contains('down') ? `${element.lastChild.scrollHeight}px` : 0;
|
||||
if (element.classList.contains('down')) {
|
||||
this.closeDropdown(element);
|
||||
} else {
|
||||
this.openDropdown(element);
|
||||
}
|
||||
},
|
||||
closeDropdown (element) {
|
||||
element.classList.remove('down');
|
||||
|
||||
Reference in New Issue
Block a user