PhotoDune

Change theme without reloading

250 posts
  • Sweden
  • Sold between 1 000 and 5 000 dollars
  • Referred between 1 and 9 users
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 2-3 years
graphic_dev says

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

81 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 3-4 years
Fynn says

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.

12 posts
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 2-3 years
  • Romania
  • Sold between 100 and 1 000 dollars
marianstefi20 says

If I am not wrong I think that it’s a plugin.You only need JQuery!I think the name was “CSS StyleSwitcher”.

2945 posts
  • Author had a File in an Envato Bundle
  • Bought between 1 and 9 items
  • Elite Author
  • Europe
  • Exclusive Author
  • Has been a member for 2-3 years
  • Referred between 100 and 199 users
+2 more
duotive says

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…

67 posts
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 1 and 9 users
  • Sold between 1 000 and 5 000 dollars
luglio7 says
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 !

7 posts
  • Elite Author
  • 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
AtiX says

We are using Cookies. But need to refresh page (CTRL+F5) to make effect.

367 posts
  • Bought between 10 and 49 items
  • Denmark
  • Exclusive Author
  • Has been a member for 3-4 years
  • Microlancer Beta Tester
UI20 says
250 posts
  • Sweden
  • Sold between 1 000 and 5 000 dollars
  • Referred between 1 and 9 users
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 2-3 years
graphic_dev says

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.

4099 posts
  • 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
+9 more
Ivor moderator says
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.-

250 posts
  • Sweden
  • Sold between 1 000 and 5 000 dollars
  • Referred between 1 and 9 users
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 2-3 years
graphic_dev says
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.-
Sweet :)
by
by
by
by
by