Fix: allow navbar dropdown parent links to navigate on desktop
Added JavaScript to handle click on dropdown-toggle links: - On desktop (>= 992px): navigates to the href URL - On mobile: allows Bootstrap dropdown toggle to work 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -310,3 +310,22 @@ 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) {
|
||||
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();
|
||||
window.location.href = href;
|
||||
}
|
||||
// On mobile, let Bootstrap handle dropdown toggle
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user