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);
|
||||
|
||||
// === NAVBAR DROPDOWN - Allow parent links to navigate on desktop ===
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
document.querySelectorAll('.navbar .dropdown > .dropdown-toggle[href]').forEach(function(link) {
|
||||
// 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
|
||||
});
|
||||
});
|
||||
// NOTE: Navbar dropdown parent links now work natively
|
||||
// The PHP walker only adds data-bs-toggle="dropdown" for items without real URLs
|
||||
// CSS hover handles showing dropdowns on desktop
|
||||
|
||||
Reference in New Issue
Block a user