matchActiveUrl: Activate Menu Items
Marking active menu items is usualy best left to a server-side application. If a server-side approach is not possible, this script will seek out and mark active menu items, based on the URL of the page.
Marking Matching Items
The list below contains many links to this page, called with a different URL each. This simulates the many URLs of a web-site. Click on each and observe the selected link light up and its contents revealed.
The script compares the HREF of each link to the URL of the page. When it finds a match, it will add the class-name "active".
Required Files
-
jQuery Addon Script: jquery.classbehaviours.matchactiveurl.js
- Prerequisite Script: jquery.classbehaviours.classmousehover.js
- Prerequisite Script: jquery.classbehaviours.srcmousehover.js
- Prerequisite Script: jquery.classbehaviours.js
- Example Markup: matchActiveUrl.html
- Example Stylesheet: matchActiveUrl.css
Comments on this Article