Skip to content

Dropzone.js – 4 [image preview: onclick image, open in new tab]

We often want to download/preview to make it sure what we have uploaded. A small thumbnail preview sometimes not enough. So, here is a small javascript. That will open the image in new tab.

$( document ).ready(function() {
myDropzone.on("addedfile", function(file) {
        file.previewElement.addEventListener("click", function(e) {
          var win = window.open(this.querySelectorAll('.dz-image > img')[0].src, '_blank');
          win.focus();
        });
      });
  });

Full and final code can be found in my github repository : https://github.com/khairulhasanmd/dropzone-test

One Comment

  1. AffiliateLabz AffiliateLabz

    Great content! Super high-quality! Keep it up! 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *