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:

http://jsfiddle.net/wacku/

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;     ... } 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

java - How to create Table using Apache PDFBox -

mpi - Why is MPI_Bsend not returning error even when the buffer is insufficient to accommodate all the messages -