JSFiddle - React, Tailwind, and code Playground
by Aleksandr Yurchenko
HTML
<img class="img d-none" src="https://avatars.mds.yandex.net/get-pdb/2395147/8056144c-5f6a-4869-bebe-a848b1b154eb/s1200" width="300" alt="">
CSS
.d-none {
display: none;
}
JavaScript
$(function() {
// Событие: "кнопку нажали"
$(document).on('keydown', function(e) {
if (e.shiftKey) {
$('img').removeClass('d-none');
}
});
// Событие: "кнопку отпустили"
$(document).on('keyup', function(e) {
if (!e.shiftKey) {
$('img').addClass('d-none');
}
});
});