Remove redundant JS dropdown handler - PHP fix is sufficient
This commit is contained in:
@@ -311,23 +311,6 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||||||
|
|
||||||
window.addEventListener('scroll', updateActiveSection);
|
window.addEventListener('scroll', updateActiveSection);
|
||||||
|
|
||||||
// === NAVBAR DROPDOWN - Allow parent links to navigate on desktop ===
|
// NOTE: Navbar dropdown parent links now work natively
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
// The PHP walker only adds data-bs-toggle="dropdown" for items without real URLs
|
||||||
document.querySelectorAll('.navbar .dropdown > .dropdown-toggle[href]').forEach(function(link) {
|
// CSS hover handles showing dropdowns on desktop
|
||||||
// Use capture phase to run before Bootstrap's handlers
|
|
||||||
link.addEventListener('click', function(e) {
|
|
||||||
var href = this.getAttribute('href');
|
|
||||||
// Only navigate if link has a real URL (not # or empty)
|
|
||||||
if (href && href !== '#' && href !== '' && href !== '#!') {
|
|
||||||
// On desktop (>= 992px), navigate to the link
|
|
||||||
if (window.innerWidth >= 992) {
|
|
||||||
e.preventDefault();
|
|
||||||
e.stopPropagation();
|
|
||||||
e.stopImmediatePropagation();
|
|
||||||
window.location.href = href;
|
|
||||||
}
|
|
||||||
// On mobile, let Bootstrap handle dropdown toggle
|
|
||||||
}
|
|
||||||
}, true); // true = capture phase, runs before bubbling phase handlers
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|||||||
Reference in New Issue
Block a user