Fix toggle color schema button on desktop
This commit is contained in:
@ -14,15 +14,20 @@ const {} = Astro.props;
|
||||
}
|
||||
|
||||
function attachEvent(selector, event, fn) {
|
||||
const elem = document.querySelector(selector);
|
||||
if (elem) {
|
||||
elem.addEventListener(
|
||||
event,
|
||||
function () {
|
||||
fn(elem);
|
||||
},
|
||||
false
|
||||
);
|
||||
const matches = document.querySelectorAll(selector);
|
||||
console.log(matches);
|
||||
if (matches && matches.length) {
|
||||
console.log("Hello");
|
||||
matches.forEach((elem) => {
|
||||
console.log(elem);
|
||||
elem.addEventListener(
|
||||
event,
|
||||
function () {
|
||||
fn(elem);
|
||||
},
|
||||
false
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ const {} = Astro.props;
|
||||
type="button"
|
||||
class="text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 focus:outline-none focus:ring-4 focus:ring-gray-200 dark:focus:ring-gray-700 rounded-lg text-sm p-2.5 inline-flex items-center"
|
||||
aria-label="Toggle between Dark and Light mode"
|
||||
onclick="window.toggleDarkMode()"
|
||||
data-aw-toggle-color-scheme
|
||||
>
|
||||
<IconSun />
|
||||
</button>
|
||||
|
Reference in New Issue
Block a user