Categories
JavaScript PHP

Change live CSS with JS and PHP

We are going to use a simple methos to change the css of your site live. So for example you can let your users choos the template or color that they like the most.

I used twitter bootstrap and the bootswatch (amazing) for this example.

In the header of your HTML:
Here we load the CSS in case there’s a cookie we use the previous used one.


We add some buttons to let the user choose:

	

And finally some javascript at the bottom, remember to load jQuery if not doesn’t work.


	


And that’s all 😉