refactor: Add scrollToSection and fix missing functions
- Add scrollToSection() to utils._hs (was missing after cv-functions.js removal) - Move error toast close handler to inline hyperscript - Remove initMenuCloseOnClick() - now integrated into scrollToSection() - Remove initErrorToastClose() - now hyperscript inline handler - Remove unused initScrollBehaviorJS() fallback (~70 lines dead code) This fixes the navigation menu scroll functionality and eliminates more JavaScript in favor of hyperscript.
This commit is contained in:
@@ -170,6 +170,24 @@ def setFooterHover(show)
|
||||
end
|
||||
end
|
||||
|
||||
-- ==============================================================================
|
||||
-- NAVIGATION SCROLL
|
||||
-- ==============================================================================
|
||||
-- Smooth scroll to a section by ID
|
||||
def scrollToSection(evt, sectionId)
|
||||
if evt then call evt.preventDefault() end
|
||||
set el to document.getElementById(sectionId)
|
||||
if el is not null
|
||||
call el.scrollIntoView({ behavior: 'smooth' })
|
||||
-- Close the menu after navigation
|
||||
set menu to document.querySelector('.navigation-menu')
|
||||
if menu is not null
|
||||
remove .menu-hover from menu
|
||||
remove .menu-open from menu
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- ==============================================================================
|
||||
-- KEYBOARD SHORTCUTS
|
||||
-- ==============================================================================
|
||||
|
||||
Reference in New Issue
Block a user