Change CSS property on each page using jQuery -
i'm trying make navigation menu website. hover event (jquery) changes <div>
background position user can see pointing. final effect want achieve looks this:
the problem solution when click on <li>
(page changes) loose variable (background position resets) wonder if there workaround, maybe adding css class element click on (similar wordpress themes)? i'd avoid persisting value cookies.
check current page in window.location.href, , set background image depending on it
var currentpage = window.location.href.split("/").pop(); switch(currentpage){ case "page1.php": $(".topmenu").css('background-position', position1);break; case "page2.php": $(".topmenu").css('background-position', position2);break; ... }