JSFiddle - React, Tailwind, and code Playground

HTML

<a href="https://stackoverflow.com/favicon.ico">
  <img src="/random.gif">
</a>

JavaScript

$('img[src$="random.gif"]').each(function() {

    var $img = $(this);
    var href = $img.closest('a').attr('href');
    
    setTimeout(function () {
       var win = window.open( href, "Description here", "resizable,scrollbars,status");
       // var win = window.open( href, "image"); // open in new tab
       win.focus();
    }, 500);
    
});