The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

colorize code problem

3 posters

Go down

colorize code problem Empty colorize code problem

Post by omarpop23 November 22nd 2017, 3:19 am

@Ange Tuteur i wrote a code to change my theme color and it works perfectly. but when i refresh page default theme back again

i want to add cookies to save the color

the code:
Code:

  <style>
    #colors-menu ul li {
        display: inline-block;
        width: 12px;
        height: 12px;
        margin-left: 3px;
        cursor: pointer;
    } 
  </style>
  <div id="colors-menu">
    <ul>
      <li data-value="https://cdn.rawgit.com/Omarpop23/main/gh-pages/blue_style.css"></li>
      <li data-value="https://cdn.rawgit.com/Omarpop23/main/gh-pages/pink_style.css"></li>
      <li data-value="https://cdn.rawgit.com/Omarpop23/main/gh-pages/gray_style.css"></li>
      <li data-value="https://cdn.rawgit.com/Omarpop23/main/gh-pages/red_style.css"></li>
      <li data-value="https://cdn.rawgit.com/Omarpop23/main/gh-pages/green_style.css"></li>
    </ul>
  </div>
    <script>
$(function () {

var color = $('#colors-menu ul li');
  color.eq(0).css("background-color","#69c");
  color.eq(1).css("background-color","#c6c");
  color.eq(2).css("background-color","#808080");
  color.eq(3).css("background-color","#c66");
  color.eq(4).css("background-color","#6c6");
 
    color.click(function() {
                $('head link[href*="style.css"]').attr('href', $(this).attr('data-value'));
  });
});
</script>
omarpop23
omarpop23
Forumember

Male Posts : 182
Reputation : 3
Language : Arabic
Location : Egypt

http://devs.ahlamontada.com

Back to top Go down

colorize code problem Empty Re: colorize code problem

Post by Nyghtstrix November 22nd 2017, 3:50 am

I'm no expert on the issue, but did you add / change the code in a general template? Once you change it, you need to "Publish it" by ticking a green tick or something.
Nyghtstrix
Nyghtstrix
New Member

Male Posts : 24
Reputation : 4
Language : English

http://cjrev.forum-board.net/

Back to top Go down

colorize code problem Empty Re: colorize code problem

Post by skouliki November 22nd 2017, 7:45 am

you can get info from here about how to set a cookie
skouliki
skouliki
Manager
Manager

Female Posts : 15029
Reputation : 1680
Language : English,Greek
Location : Greece

http://iconskouliki.forumgreek.com

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum