Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript JQuery's action go to start when I reload the page Reply To: JQuery's action go to start when I reload the page

#256033
rkieru
Participant

This needs a bit more clarity – if I understand you correctly you want to make sure that the current active page (ex. foo.html vs. bar.html) has the .active-trail class applied.

In order to do that you need some way to determine the current page and that’s going to depend largely on your environment (WordPress, static HTML, etc, etc).

To use WordPress as an example; if this is your main navigation you could add a function to your theme to apply the aforementioned class as outlined in the following question on StackOverflow:

https://stackoverflow.com/questions/35645264/wordpress-adding-active-class-to-active-menu-items-sub-pages

The answer in the above link also outlines a CSS-only option which may appeal to you, as WordPress should (by default) already apply a special class to the current page.