mirror of
https://github.com/picocss/pico.git
synced 2025-04-20 16:46:14 -04:00
JS improvement
This commit is contained in:
parent
f5e4d01cbb
commit
afb22b9c3a
7 changed files with 46 additions and 34 deletions
|
@ -18,7 +18,7 @@
|
|||
on: '<i>Turn on dark mode</i>',
|
||||
off: '<i>Turn off dark mode</i>'
|
||||
},
|
||||
target: 'main', // Button inserted after target
|
||||
target: 'body', // Button append in target
|
||||
selector: 'button.switcher', // Button selector in Dom
|
||||
currentTheme: systemColorScheme()
|
||||
};
|
||||
|
@ -59,7 +59,7 @@
|
|||
// Insert Switcher
|
||||
var button = document.createElement(switcher.button.element);
|
||||
button.className = switcher.button.class;
|
||||
document.querySelector(switcher.target).after(button);
|
||||
document.querySelector(switcher.target).appendChild(button);
|
||||
|
||||
// Set Current Theme
|
||||
setTheme(switcher.currentTheme);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue