Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -265,18 +265,20 @@ <h3>Red Hat Mono Variable Font</h3>
</div>
</main>

<script>
// Find all range inputs and wire them up so they automatically change
// the font weight.
const inputs = document.querySelectorAll('input[type="range"]');
<script>
// Find all range inputs and wire them up so they automatically change
// the font weight.
const inputs = document.querySelectorAll('input[type="range"]');

// listen for changes
inputs.forEach(input => input.addEventListener('change', handleUpdate));
inputs.forEach(input => input.addEventListener('mousemove', handleUpdate));
// listen for changes
inputs.forEach(input => input.addEventListener('change', handleUpdate));
inputs.forEach(input => input.addEventListener('mousemove', handleUpdate));
inputs.forEach(input => input.addEventListener('input', handleUpdate)); // Added this line

function handleUpdate(e) {
document.querySelector(`.${this.id}`).style.setProperty('--font-weight', this.value);
}
</script>

function handleUpdate(e) {
document.querySelector(`.${this.id}`).style.setProperty('--font-weight', this.value);
}
</script>
</body>
</html>