|
|
|
|
|
by mintplant
3751 days ago
|
|
This was a tough puzzle to crack, but I've got it fully solved here: https://jsfiddle.net/5c0ruh8s/10/ Works cross-browser, submits a POST request to record votes, and hides both vote buttons after submitting. Each up/down arrow is an <input type="image">, part of a form that submits to a hidden iframe. When either goes :active, a CSS sibling selector sets the height of a floating div from 0px to 100% to cover up the vote arrows. There's no selector for "button that's been clicked once before", so I use a CSS transition that has a delay of 0s to expand the height and a delay of 99999999s (basically forever) to shrink the height back down again when the arrow button goes from active->inactive. While the arrow button is :active I use "pointer-events: none" to make sure the click goes through, but once the form is submitted and the button goes inactive the div becomes opaque to click events again, so the UI only allows a vote to go through once. No JavaScript required! |
|