mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-08-16 13:47:28 +02:00
add null check dropdown
This commit is contained in:
parent
64d8ef4a39
commit
4149804183
@ -93,7 +93,7 @@ if (searchDropdown && searchInput) {
|
|||||||
// Create a single dropdown instance
|
// Create a single dropdown instance
|
||||||
const dropdownInstance = new bootstrap.Dropdown(searchDropdown);
|
const dropdownInstance = new bootstrap.Dropdown(searchDropdown);
|
||||||
|
|
||||||
// Handle click for mobile
|
// Handle click for mobile
|
||||||
searchDropdown.addEventListener('click', function (e) {
|
searchDropdown.addEventListener('click', function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const isOpen = dropdownMenu.classList.contains('show');
|
const isOpen = dropdownMenu.classList.contains('show');
|
||||||
@ -122,8 +122,8 @@ if (searchDropdown && searchInput) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Hide dropdown if it's open and user clicks outside
|
// Hide dropdown if it's open and user clicks outside
|
||||||
document.addEventListener('click', function(e) {
|
document.addEventListener('click', function (e) {
|
||||||
if (!searchDropdown.contains(e.target) && dropdownMenu.classList.contains('show')) {
|
if (dropdownMenu && !searchDropdown.contains(e.target) && dropdownMenu.classList.contains('show')) {
|
||||||
dropdownInstance.hide();
|
dropdownInstance.hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user