I’m doing the calculator challenge and want to change the background image of a button when it is being clicked or tapped.
Using the :active css pseudoclass doesn’t work, so for mouse events I’m using the :focus class and blurring the buttons on mouseleave:
keysContainer.on("mouseleave touchend", "button", function(e){
// e.currentTarget.blur()
this.blur();
})
However, this does not work for touch events, even though the touchend event fires correctly.
The full code is here: https://codepen.io/pwkrz/pen/zRRObG
I would be grateful for any suggestions.