Hi, How do I make a function where the user can click on an image and change the theme (by changing the theme i mean changing some backgrounds, text colors etc)?
See this site: http://www.netdreams.co.uk/ (click on toolbox on the top right of the header div).
I notice the links looks like this:<a href="?set_colour=purple" id="purple">purple</a>
How do i get that “set_colour”? I don’t know how to do id without PHP … And how do I update? JavaScript and if-statements or what?
Thanks
- Bought between 10 and 49 items
- Exclusive Author
- Has been a member for 3-4 years
Hey graphic_dev,
You can do it with jQeury and change the CSS file. You can make a main CSS file with all the regular styles, and a seperate CSS file with the color settings for every theme color.
Something like this:
$("a.color").click(function() {
$("link#sub").attr("href",$(this).attr('rel'));
return false;
});
- a.color is a link with the class color
- link#sub is the link to the color stylesheet with a id of main
Put this between the head tags:
<link href="" rel="stylesheet" id="sub" media="screen" type="text/css" />
And this in the body:
<a href="#" class="color" rel="css/color.css">Change color</a>
I think this should work.
If I am not wrong I think that it’s a plugin.You only need JQuery!I think the name was “CSS StyleSwitcher”.
- Author had a File in an Envato Bundle
- Author was Featured
- Bought between 1 and 9 items
- Europe
- Exclusive Author
- Has been a member for 2-3 years
- Item was Featured
- Referred between 100 and 199 users
the ?set_colour=purple is for php $_GET[‘set_colour’] but this form is submitted with ajax… you will need to choose a type of changing colors: javascript / php. but this depends of your themeing… how can u change the theme color? post a link to the development website and i can take a look…
Hi, How do I make a function where the user can click on an image and change the theme (by changing the theme i mean changing some backgrounds, text colors etc)?See this site: http://www.netdreams.co.uk/ (click on toolbox on the top right of the header div).
I notice the links looks like this:<a href="?set_colour=purple" id="purple">purple</a>How do i get that “set_colour”? I don’t know how to do id without PHP … And how do I update? JavaScript and if-statements or what?
Thanks
You can use cookie !
- Sold between 100 000 and 250 000 dollars
- Has been a member for 3-4 years
- Author had a Free File of the Month
- Europe
- Exclusive Author
- Bought between 10 and 49 items
- Referred between 100 and 199 users
We are using Cookies. But need to refresh page (CTRL+F5) to make effect.
- Bought between 10 and 49 items
- Denmark
- Exclusive Author
- Has been a member for 3-4 years
- Microlancer Beta Tester
This one does it realtime. Maybe someone can figure out how.
Thanks for the answers.
I found something that could be worth looking at. Seems to be very popular:
http://www.kelvinluck.com/assets/jquery/styleswitch/toggle.html
Haven’t had time to try it yet though.
- Envato Staff
- Reviewer
- Community Moderator
- Venezuela
- Has been a member for 4-5 years
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Microlancer Beta Tester
- Sold between 10 000 and 50 000 dollars
- Exclusive Author
Thanks for the answers.I found something that could be worth looking at. Seems to be very popular:
http://www.kelvinluck.com/assets/jquery/styleswitch/toggle.html
Haven’t had time to try it yet though.
That’s what I’m using in my latest file
works like a charm.-
SweetThanks for the answers.That’s what I’m using in my latest fileI found something that could be worth looking at. Seems to be very popular:
http://www.kelvinluck.com/assets/jquery/styleswitch/toggle.html
Haven’t had time to try it yet though.works like a charm.-

