I have a div called key-features and a header/naviagtion bar at the top. I want this navigation bar to disappear when the user is on the key-features section and then return back after the leave. This key-features section is also on a horizontal scrolling.
I have been searching for javascript codes that detect if the user is in a specific section or not but i couln’t find any. Pls help
2
Answers
You can use the
onmouseenter
andonmouseleave
event attributes in HTML to call JavaScript code which selects an element from the DOM and adds a style to hide it.HTML:
JavaScript:
you can use JavaScript to detect the scroll position and toggle the visibility of the navigation bar based on whether the user is in the "key-features" section