Fix toggle color schema button on desktop
This commit is contained in:
@ -14,8 +14,12 @@ const {} = Astro.props;
|
|||||||
}
|
}
|
||||||
|
|
||||||
function attachEvent(selector, event, fn) {
|
function attachEvent(selector, event, fn) {
|
||||||
const elem = document.querySelector(selector);
|
const matches = document.querySelectorAll(selector);
|
||||||
if (elem) {
|
console.log(matches);
|
||||||
|
if (matches && matches.length) {
|
||||||
|
console.log("Hello");
|
||||||
|
matches.forEach((elem) => {
|
||||||
|
console.log(elem);
|
||||||
elem.addEventListener(
|
elem.addEventListener(
|
||||||
event,
|
event,
|
||||||
function () {
|
function () {
|
||||||
@ -23,6 +27,7 @@ const {} = Astro.props;
|
|||||||
},
|
},
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ const {} = Astro.props;
|
|||||||
type="button"
|
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"
|
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"
|
aria-label="Toggle between Dark and Light mode"
|
||||||
onclick="window.toggleDarkMode()"
|
data-aw-toggle-color-scheme
|
||||||
>
|
>
|
||||||
<IconSun />
|
<IconSun />
|
||||||
</button>
|
</button>
|
||||||
|
Reference in New Issue
Block a user