Sueta
[J

[Javascript] COOKIES SWITCH STYLE

1.4

You can switch your style !

·Plugin

Hi !!

You can width this code change style .css !

<div class="WindowBody"> 



<div class="StyleOverlay" onclick="switchStyle('');"> 
                            <span class="icon style54"><span></span></span> 
                            <span class="title">Default</span> 
                            <span class="description"></span> 
                    </div> 


<div class="StyleOverlay" onclick="switchStyle('YOUR FOLDER .css');"> 
                            <span class="icon style54"><span></span></span> 
                            <span class="title">UI.X</span> 
                            <span class="description"></span> 
                    </div> 

<div id="idFond" style="display: block;"> 
</div> 
</div>

for change your style.css/theme, you must use a cookie and a link href like this :

<script type="text/javascript"> 
var theCookie=getCookie("styleChoose"); 
if(theCookie == null){ 
  theCookie=""; 
} 
switchStyle(theCookie); 
function switchStyle(style){ 
document.getElementById("mycss").setAttribute("href", style); 
   document.cookie = "styleChoose="+style+";expires=Thu, 1 Jan 2100 00:00:00 GTM;path=/;domain=YOUR DOMAIN (ex: clepopiplay.com)"; 
} 
function getCookie(name) { 
  var value = "; " + document.cookie; 
  var parts = value.split("; " + name + "="); 
  if (parts.length == 2) return parts.pop().split(";").shift(); 
  return null; 
} 
</script>

WARNING :
configure the domain name in the cookie / javascript at : "domain=YOUR DOMAIN (ex: clepopiplay.com)";

For link .css

HTML 5

<link rel="stylesheet" type="text/css" href="" id="mycss">

SIMPLE DEMO AT THIS FOLDER (download):

http://mc.clepopiplay.com/wp-admin/css/SIMPLE DEMO.zip

ALL THE CODE FOR THE LANGUAGE HTML5:

<link rel="stylesheet" type="text/css" href="" id="mycss"> 

<div class="StyleOverlay" onclick="switchStyle('');"> 
                            <span class="icon style54"><span></span></span> 
                            <span class="title">Default</span> 
                            <span class="description"></span> 
                    </div> 


<div class="StyleOverlay" onclick="switchStyle('YOUR FOLDER .css');"> 
                            <span class="icon style54"><span></span></span> 
                            <span class="title">UI.X</span> 
                            <span class="description"></span> 
                    </div> 

<script type="text/javascript"> 
var theCookie=getCookie("styleChoose"); 
if(theCookie == null){ 
  theCookie=""; 
} 
switchStyle(theCookie); 
function switchStyle(style){ 
document.getElementById("mycss").setAttribute("href", style); 
   document.cookie = "styleChoose="+style+";expires=Thu, 1 Jan 2100 00:00:00 GTM;path=/;domain=YOUR DOMAIN (ex: clepopiplay.com)"; 
} 
function getCookie(name) { 
  var value = "; " + document.cookie; 
  var parts = value.split("; " + name + "="); 
  if (parts.length == 2) return parts.pop().split(";").shift(); 
  return null; 
} 
</script>

Exemples :

upload_2019-5-14_20-32-52.png
style : Default (click on default style) click this button :
upload_2019-5-14_20-36-31.png
UIX or Default, you can add the styles, if you have a problem please contact me !

upload_2019-5-14_20-33-23.png
Style UIX

WARNING :
configure the domain name in the cookie / javascript

if you have a problem please contact me !

Similar projects

Plugin →