Skip to content

pau4o/simple-css-switch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple CSS Switch

Installation

Download simple-css-switch.js to your project JavaScript folder.

HTML modifications

links to CSS files

All links to CSS themes must have class="s-css-s--style" and title="Some title"

Default theme must have rel="stylesheet" , other CSS themes must have rel="stylesheet alternate" See example below:

<link class="s-css-s--style" rel="stylesheet"           title="Default style" href="css/main.css">
<link class="s-css-s--style" rel="stylesheet alternate" title="Red style"     href="css/red.css">
<link class="s-css-s--style" rel="stylesheet alternate" title="Green style"   href="css/green.css">

Add attribute onload="simpleCssSwitch()" to body tag

Insert container for CSS switch menu

Place where you want following snippet

<div id="s-css-s--menu"></div>

It will be auto populated with buttons for available CSS themes.

Customisation

Simple CSS Switch has no default positioning and style.

Example style can be seen in simple-css-switch.css