<label>
Do heavy work
<input type="checkbox" id="check" />
</label>
<script>
// Checbox selection will NOT be responsive
check.addEventListener("change", (e) => {
block(5000);
});
// This will block the main thread for ~5 seconds
function block(milliseconds) {
const start = performance.now();
while (performance.now() - start < milliseconds) {}
}
</script>
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.