JSFiddle - React, Tailwind, and code Playground

by naokiota

HTML

<img class="myimg" src="http://placehold.it/350x150">

JavaScript

var clickCount = 0;

$(".myimg").click( function() {
    clickCount++;
    if (clickCount === 1) {
        setTimeout(function() {
            clickCount = 0;
            $(this).show();
        }, 400);
    } else if (clickCount === 3) {
        clearTimeout(singleClickTimer);
        clickCount = 0;
        $(this).hide();
    }
   
    return false;
});