Include Image in center in QR code
ashish20790 opened this issue · 1 comments
ashish20790 commented
Hello,
Is there a way that we can include some image in the center of generated QR code via qrcode.js.
XiXiongMaoXiong commented
A little workaround is to use jQuery to remove the display: block property from the img tag that holds the QRCode, this can be done after you've created the QRCode instance and the data is rendered to the target tag.
Example:
new QRCode(document.getElementById("qrCodeHolder"), "https://example.com/");
$("#qrCodeHolder").find("img").css("display", "");
EDIT: I'd suggest you delay the jQuery code by 500 ms or so, because there's a high chance that the QR code isn't rendered yet while jQuery is looking for the element.
So better use a setTimeout().