Advertisement
Guest User

Untitled

a guest
Sep 30th, 2014
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(function () {
  2.     var name = getUrlVars()["page"];
  3.     $("#nav a[name*=" + name + "]").addClass("active");
  4. });
  5.  
  6. // Read a page's GET URL variables and return them as an associative array.
  7. function getUrlVars() {
  8.     var vars = [], hash;
  9.     var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
  10.     for (var i = 0; i < hashes.length; i++) {
  11.         hash = hashes[i].split('=');
  12.         vars.push(hash[0]);
  13.         vars[hash[0]] = hash[1];
  14.     }
  15.     return vars;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement