Is there a way JS can remember function on new page?
I have a simple script (below) that on click (to the element with an id of #addClass) adds a class (.switcher) to the body tag. The script uses jquery.
I would like to know if it's possible to modify this script so that when the user moves on to the next page within the site the added class remains in place? In fact the class needs to stay in place until the element with an id #removeClass has been clicked no matter how many pages the user chooses to browse through. Please be gentle with your responses - I'm not much of a coder! If it's not possible with this script (or indeed with JS) does anyone have any suggestions as to how it may be possible
Mmm, the solution lies in saving the switcher false|true state somewhere. There are three basis choices; cookie, PHP $_session var, database. Each has its own scope.
(Before someone mentions it, a fourth option is to send the "switcher=0|1" on the url querystring merry-go-round but that would need to involve every internal url in the whole site so don't even think about it unless WP makes specific provision for such).
Sorry, it's not a gentle answer and sorry I can't help further.