- This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
- The forum ‘JavaScript’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › JavaScript › Sliding line navigation menu staying on active link
I recently saw this and I began searching. I found something similar here. I was wondering is there a way to make the line stay on the active link (the page being viewed?) Or slide to link permanently when it is being clicked and the content is loaded(until a new link is clicked)? Or do I have to use ajax for that?
if you look at how the code on that page works it is set to automatically set the “magic line” to move to be under the nav item withe the current_page_item class once the page loads. Just make sure that that class gets applied to the proper item and it should work. If you’re using a cms, it should do this by default, just view source and find out what the name of the class and update you’re code.
If you’re doing a one page site or using ajax to bring in content, just add some code in there to set the current_page_item on click.
For Ajax or one page site I would need to set it on click so that when the content loads the line will move to that link’s content? For CMS I wouldn’t have to apply it to the link myself because it will be done automatically(since it knows which link I’ve clicked on)? Thanks