This commit is contained in:
2025-11-10 20:13:20 -06:00
parent 68f67f5839
commit 4773d620bb

View File

@@ -174,7 +174,7 @@ I added this include in my base layout, after the footer, just before the the cl
Now all we need to do is make sure {% raw %}`{{ metadata.weatherSymbol }}`{% endraw %} exists and we should be cooking with gas. To `_data/metadata.js` I added: `weatherSymbol: "🍁",`; a falling leaf for autumn.
## Settings
Now we have our ~~falling-snow~~ falling leaf effect working but, as with anything fun, there are going to be at least a few crabbit souls who are going to hate this. For them, let's implement a toggle. First, the toggle itself, in `_includes/weatherController.njk`:
Now we have our ~~falling-snow~~ falling leaf effect working but, as with anything fun, there are going to be at least a few crabbit souls who will hate this. For them, let's implement a toggle. First, the toggle itself, in `_includes/weatherController.njk`:
``` html
<form id="weatherController">
@@ -208,7 +208,7 @@ Let's first add a quick rule to our CSS:
Then we can work on our script. Let's add it to the bottom of our weather include, `_includes/weather.njk`, as it's positioned right before the closing `</body>` tag.
First, we'll check local storage to see if the user has set a preference before; if so, we'll add/remove our `.hidden` CSS rule to our weather element and update the weather-controller checkbox accordingly:
First, we'll check local storage to see if the user has set a preference before; if so, we'll add/remove the `.hidden` CSS rule to our weather element and update the weather-controller checkbox accordingly:
``` javascript
<script>