css - Simple jQuery stylesheet swaper -


I am trying to create a swapper on the website. I have a link, and I want to swap it between two CSS files on each click. After the first click, I think that classes and files are swapping, but after the second click nothing happens ...

   

jQuery code:

  google.load ("jquery", "1.3.1"); ("Href", "link_to_style1.css"); Click on $ ("# swaper") (function () {$ (". Color_ozn") (function () {$ ("link"). $ ("Color_ozn"); $ ("# swaper") AddClass ("color"); return;}); $ (".color"). Click (function () {$ ("link"). Attr ("href", "link_to_style2.css"); $ ("# Swapper"). Delete class ("color"); $ ("# swapper") AddClass ("color_ozn"); return false;});});  

Since you are swapping classes dynamically, you get it You will want to use it in this context.

Try,

  $ ('body'). ("Click", ". Color_ozn", function () {$ ("link") $ ("href", "link_to_style1.css"); $ ("# swapper"). RemoveClass ("color_ozn"); $ ("# Swapper"). AddClass ("color"); return;}); ("Click", "color", function () {$ ("link")  

and

  $ ('body'). $ $ ("Href", "link_to_style2.css"); $ ("# swapper"). Remove clause ("color"); $ ("# swapper"). Adclass ("color_ozen"); return false;});  

Comments