函数 CreateImage 函数动态地创建一个新图像并将它们放入一个 div 中。当鼠标悬停在动态创建的图像上时,如何使用 fancybox?
function createImage(source) {
var pastedImage = new Image();
pastedImage.onload = function () {}
pastedImage.src = source;
pastedImage.width = 150;
pastedImage.height = 150;
pastedImage.title = 'Click on the image to preview';
pastedImage.setAttribute('class', 'dynamicPic');
pastedImage.setAttribute('id', 'dynamicPic');
var dynamicDiv = document.createElement('div');
//div.innerHTML = "";
dynamicDiv.setAttribute('class', 'dynamicDiv');
dynamicDiv.setAttribute('id', 'dynamicDiv');
dynamicDiv.appendChild(pastedImage);
$('#editableDiv').before(dynamicDiv);
}