Hello,
i'm a media designer with a very basic knownledge of JS. I have problem with a script on a website i created and would love some help...
Here is the situation:
In the main menu of my Wordpress website I have a page that includes three different profile pages that are reachable through another menu on this certain page. But the main menu topic doesn't show as active with this profile pages. These profiles create an URL like that: ?team=name.
My idea: to "addClass" the class "active" in the main menu topic (#menu-item-234) when this part "?team" is shown in the URL. I tried to code it but I'm not surprised it doesn't work... ;-) I don't really know what i'm doing ..Did I explain it understandable? Can someone help me, I would appreciate it very much..
<script type="text/javascript"> $(document).ready(function(){ if ( document.location.hash === '?team' ) { $("#menu-item-234").addClass("active"); } else if { document.location.hash !== '?team' } { $("#menu-item-234").removeClass("active"); } });</script>