Menu hover effect when scrolling on the page - javascript

I created a site with a top navigation bar that has hyperlinks to anchors in the same page for different content.
I'm trying to create a hover effect on the navigation bar when a user scrolls past the corresponding anchor in the same page. For example, when I scroll past link1's anchor, I want the top navigation hyperlink for link1 to change to a different color.
I tried searching Google but can't find anything relevant to do this.
Can someone point me in the right direction or provide some code examples for how I might do this using HTML/CSS/Jquery/Javascript, etc?

Sounds like you want a ScrollSpy plugin.

Related

Horizontal Scroll on click

Does anybody knows how to implement horizontal scrolling on event? I am trying to replicate this functionality: http://www.spotify-valentines.com/#/home
First, it scrolls fullpage to the right. Then, it scrolls half way to the right. Then it scrolls full page, also to the right, and finally it becomes a normal screen with vertical scrolling.
The site seems to be built with Angular, but I am not sure how this functionality is accomplished.
Thanks!
It can be accomplish by using fullPage.js.
Just create a single section with multiple slides in. Then you can create your custom buttons and associate them with the action $.fn.fullpage.moveTo() or $.fn.fullpage.moveSlideRight() or $.fn.fullpage.moveSlideLeft().

One page dot navigation that misses out the middle sections

It's hard to explain the effect I want and the only place I have seen this navigation so far is on the tumblr login/home page: https://www.tumblr.com/
It scrolls down a section on mouse scroll similar to this: http://alvarotrigo.com/fullPage/ but manages to miss out the sections in between anchors when the dot navigation is used. So using the navigation you can scroll straight from dot 1 to dot 5 without scrolling past dot 2, 3 and 4. And it maintains the scrolling effect rather than jumping down to the 5th anchor.
I'm not sure whether it would be best to try and load the content of the next div/iframe dynamically depending where the user is on the site or have all the divs laid out and just move them around with css depending on where the user is currently on the site.
If anyone has any ideas that would be great, thanks for your time
As suggested by #Barbara Laird, you should be using pagePiling.js to achieve that same effect.

How to disable scrolling but keep the ability to scroll with an anchor link?

I am making this site on which I don't want people to be able to scroll with the mouse or the arrow buttons but I want it to be possible to scroll with the anchor links.
On the link provided by #Hugo Sousa you can still scrolling dragging the scroll bar.
You can try using fullPage.js for it using the method $.fn.fullpage.setAllowScrolling(false).
Basically, users won't be able to scroll in the normal way if there's no scroll bar. So this sounds like a good solution for your problem.

Change CSS based on scroll position/anchor points

On my site I'm currently having users click on a set of navigation links that will, onclick, highlight their backgrounds yellow.
I remember seeing a similar effect on this site at http://docs.meteor.com/
Here, when user scrolls to a specific anchor in the document, the navigation element that links to it is highlighted. How does this work? How do I begin to implement something like this on my page?
Any brief pieces of example code would be greatly appreciated. I've been working with some JavaScript for a while now and haven't been able to recreate anything.
EDIT: To clarify the effect I'm looking at on the Meteor site, when you scroll in the right column, the associated menu element on the left column changes font color to red. NOT, the on hover effect.
There is ready thing for that in bootstrap called scrollspy

dropdown menu stops working after page jump

My head is about to explode as I try to figure out the reason why my dropdown menu stops working as soon as the page jumps to an anchor. There is some JS involved in the jump, too, but the same problem existed even with a plain html anchor jump.
The page is at http://mincovlawyer.com/doc/euro-excellence
As you load the page, please hover over "The Law", "About" and "The Goodies" and see how the dropdown is supposed to operate.
Then click any of the links in the sidebox to the right, for example Alt. #1.
Then hover over the menu items again and observe that no dropdowns emerge anymore.
I would immensely appreciate any guidance in this regard.
The rollover breaks even if you just scroll down the page. The rollover menu is positioned absolute and the navigation is positioned fixed. You could add 'position:fixed' to your rollover menu or you could add the scroll offset in your drop down menu code.
To set 'position:fixed':
At line 8 of the anylinkmenu.css file, change the position:absolute to position:fixed.
It looks like they're working, but they are above the top of the page. Before clicking on any of the links, scroll down just a little bit. Then hover over "The Law" and you'll see your menu shifted vertically.
Now that's a lot of code...
Where's your menu created? The mouse-over stuff
Question1:
Why even using any javascript for an inline-anchor? Using #links scrolls to said position anyways, even without JS?!

Categories

Resources