PHP Classes

File: vendor/b12phpfw/themes/picocss/minimal-theme-switcher.js

Recommend this page to a friend!
  Classes of Slavko Srakocic   B12 PHP FW   vendor/b12phpfw/themes/picocss/minimal-theme-switcher.js   Download  
File: vendor/b12phpfw/themes/picocss/minimal-theme-switcher.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: B12 PHP FW
Manage database records with a PDO CRUD interface
Author: By
Last change: Update of vendor/b12phpfw/themes/picocss/minimal-theme-switcher.js
Date: 1 year ago
Size: 815 bytes
 

Contents

Class file image Download
/*! * Minimal theme switcher * * Pico.css - https://picocss.com * Copyright 2020 - Licensed under MIT */ const themeSwitcher = { // Config buttonsTarget: "a[data-theme-switcher]", buttonAttribute: "data-theme-switcher", rootAttribute: "data-theme", // Init init() { document.querySelectorAll(this.buttonsTarget).forEach ( function (button) { button.addEventListener( "click", function (event) { event.preventDefault(); document .querySelector("html") .setAttribute( this.rootAttribute, event.target.getAttribute(this.buttonAttribute) ); }.bind(this), false ); }.bind(this) ); }, }; // Init themeSwitcher.init();