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) {
|
dropdownMobile (click) {
|
||||||
this.dropdown(click.currentTarget.parentElement);
|
const element = click.currentTarget.parentElement;
|
||||||
},
|
|
||||||
dropdown (element) {
|
|
||||||
const droppedElement = document.getElementsByClassName('down')[0];
|
const droppedElement = document.getElementsByClassName('down')[0];
|
||||||
if (droppedElement && droppedElement !== element) {
|
if (droppedElement && droppedElement !== element) {
|
||||||
droppedElement.classList.remove('down');
|
droppedElement.classList.remove('down');
|
||||||
@@ -821,9 +819,11 @@ export default {
|
|||||||
droppedElement.lastChild.style.maxHeight = 0;
|
droppedElement.lastChild.style.maxHeight = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (element.classList.contains('down')) {
|
||||||
element.classList.toggle('down');
|
this.closeDropdown(element);
|
||||||
element.lastChild.style.maxHeight = element.classList.contains('down') ? `${element.lastChild.scrollHeight}px` : 0;
|
} else {
|
||||||
|
this.openDropdown(element);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
closeDropdown (element) {
|
closeDropdown (element) {
|
||||||
element.classList.remove('down');
|
element.classList.remove('down');
|
||||||
|
|||||||
Reference in New Issue
Block a user