scratchie
scratchie copied to clipboard
a stupid question...
could you tell me why all the buttons in the example are not functional? and how to fix it?
The plugin adds a <canvas> on top of the container (and also over your buttons)
Because of this canvas, you can't click anything under it.
The quick fix is to:
- Listen to the percentage of the card that was scratched off
- Once the user has scratched enough (let's say 60), remove the
<canvas>element - As a bonus you can also remove the
.js-scratchieclass from the container
There might be a better way to do this, but I haven't found it yet.
Example code:
scratchie.onScratchMove = function(percent){
if (percent > 60) {
this.canvas.remove();
this.element.classList = [];
}
};