Skip to content

Latest commit

 

History

History
19 lines (17 loc) · 1.33 KB

README.md

File metadata and controls

19 lines (17 loc) · 1.33 KB

css-switcher

A simple way to dynamically switch the css and js of a site

Using The Switcher

  • To use the switcher, set up 'scripts' and 'styles' folders in the root directory.
  • The 'scripts.js' file must be included in 'scripts' and the 'collect-themes.php' file in the root directory.
  • For the dynamic CSS, ensure that the CSS name matches the corrosponding JS name (if required). Save the CSS in the 'styles' folder and the JS in the 'scripts' folder.
  • The select will automatcially populate form the titles in the 'styles' folder.
  • Follow the in-document comments in 'scripts.js' to make adjustments to the text and sorting.

Additional Notes

  • The switcher will remember the last loaded stylesheet on page refresh
  • New visitors will be shown a random stylesheet

Working Example

The example in index.php shows how 4 different style sheets can be dynamically loaded. They are numbered using words, which are displayed alphabetically (editable in 'scripts.js'). Each stylesheet will change the background colour. There is also a random button, which will randomly select a stylesheet.