About $variables, $hook,...
By: Arshad
17 Jan 2010Snippet to add a class to the current active link for styling with css.
$(document).ready(function(){ //set class active-anchor to active anchor $('a').each(function(){ if($(this).attr('href')==window.location.search) $(this).addClass('active-anchor') }); });
There you go. Now the anchor that points to the current page will have the class active-anchor. You can style it in you css using .active-anchor.
Hello I'm Arshad. I'm a 21 years old Drupal Web Developer. This is a site i put up for some reasons i can't remember and this is where i write stuffs i need to remember.;)
In the Web world, i head the Drupal Mauritius User Group and the jQuery user Group Mauritius and i'm a campus representative for Mozilla Firefox.