Hi,
I am trying to apply day and night theme to my popups on click of btn. For example if day theme btn is clicked popup should appear in day theme and for night theme same popup should appear with night theme.
I am using
Solved! Go to Solution.
You can switch the themes dynamically at runtime with something like this.
btn.addEventListener("click", () => {
if (theme === "light") {
sheet.href = "https://js.arcgis.com/4.22/esri/themes/dark/main.css";
theme = "dark";
} else if (theme === "dark") {
sheet.href =
"https://js.arcgis.com/4.22/esri/themes/light/main.css";
theme = "light";
}
});
Here is a demo
You can switch the themes dynamically at runtime with something like this.
btn.addEventListener("click", () => {
if (theme === "light") {
sheet.href = "https://js.arcgis.com/4.22/esri/themes/dark/main.css";
theme = "dark";
} else if (theme === "dark") {
sheet.href =
"https://js.arcgis.com/4.22/esri/themes/light/main.css";
theme = "light";
}
});
Here is a demo