21 lines
709 B
JavaScript
21 lines
709 B
JavaScript
{fbd4fbe2df7aedce14d9ead0b2152bace80dae8a true 709 app.js 0xc001f10c40}
let sec = document.querySelector('.sec');
|
|
let toggle = document.querySelector('.toggle');
|
|
toggle.onclick = function() {
|
|
sec.classList.toggle('dark');
|
|
}
|
|
|
|
|
|
var percentage = document.querySelector('.percentage');
|
|
var percent = document.querySelector('.percent');
|
|
navigator.getBattery().then((battery) => {
|
|
percentage.style.width = battery.level * 100 + '%';
|
|
percent.innerHTML = battery.level * 100 + '%';
|
|
})
|
|
|
|
|
|
// var percentage = document.querySelector('.percentage');
|
|
// var percent = document.querySelector('.percent');
|
|
// navigator.getBattery().then(function(battery){
|
|
// percentage.style.width = battery.level * 100 + '%';
|
|
// percent.innerHTML = battery.level * 100 + '%';
|
|
// })
|