how to css/script up a 'click to change theme'

  • buzzby_247
  • Beginner
  • Beginner
  • buzzby_247
  • Posts: 46

Post 3+ Months Ago

hi there

i was wondering if anyone knows how to change a website via css only by clicking a button. you see on some sites 'change theme'. how easy is that? has it on their site. a default css style is loaded with 'themes' in the top right corner. is this difficult to do? is it javascript? jquery? just css?

any takers on this please
  • Bozebo
  • Expert
  • Expert
  • User avatar
  • Posts: 709
  • Loc: 404

Post 3+ Months Ago

Quite simple.
you simply set up multiple <link /> elements with different titles, the non-primary ones of type "alternate stylesheet". Then use the built in javascript function switch_style to change.

I havn't tried it out, so I am not sure how many browsers support it.

Also, you can do it with php, either in the stylesheet file itself (and use .htaccess to make it appear as a .css file) or to echo the src value of the link element.

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 30 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum

© 1998-2017. Ozzu® is a registered trademark of Unmelted, LLC.