SASS Toggles HW
Popcorn Hack: Fill in the Blanks
- The checkbox on a toggle keeps track of whether it is on or off.
- The slider is the visible part of the toggle that changes color when it is turned on.
- The
.switchclass controls the toggle’s position, size, padding, and alignment. - The border-radius property makes the slider have rounded edges.
- The
&beforeclass dictates the white circle of the toggle.
Popcorn Hack: Find the Bug
The toggle’s track <span> was missing its class. Adding ocs__toggle-track brings back the visible switch, and aria-hidden="true" tells screen readers to skip it because it is only for looks.
Challenge
Find the Bug: the track span now has the ocs__toggle-track class. Press Run and flip the toggle.
Lines: 1
Characters: 0
UI Output
Homework: Study Settings Panel
A settings panel with three toggles. Each one has its own label and controls a different part of the page:
| Toggle | What it does when it is on |
|---|---|
| Show Notifications | Shows a callout with new lesson updates |
| Show Study Tips | Shows a card with study tips |
| Highlight Due Dates | Turns the due date cell into an accent cell |
Under the toggles, a status line shows how many toggles are on, and it updates every time one is flipped. Comments in the JavaScript explain how each part works.
Challenge
Homework: three toggles that each change something on the page, plus a live count of how many are on. Press Run and flip the toggles.
Lines: 1
Characters: 0
UI Output