【发布时间】:2017-08-13 17:27:30
【问题描述】:
背景
我目前有一个测试网页,我需要在 Windows 和 Mac OS 环境中工作。目前我有一段代码可以在 IE 上运行,但是在 Mac 上测试时它不起作用。
问题
此代码旨在动态创建以下 div,然后使用我从服务调用中获得的 base64 结果填充 img 标记。问题是它从不显示在 safari 中,但它显示在 IE 上。
代码
$("#listView").kendoPanelBar({
expandMode: "single",
select: function (e) {
var retrievedContent = dataSource._data;
for (var x = 0; x < retrievedContent.length; x++) {
if (e.item.dataset.uid === retrievedContent[x].uid) {
selectedContent = retrievedContent[x];
$.when(GetImgB64(selectedContent.ServerRelativeUrl)).done(function (imageB64) {
if (imageB64) {
var formattedB64 = "data:image/jpeg;base64," + imageB64;
$(".destroyWaiting").remove();
$(e.item, ".topTabPanel").append('<div class="destroy"> Content : <button type="button" class="insertButton k-primary" id="button1" style="border: 2px none; border-radius: 25px; margin-left: 15px; margin-top: 5px;">Insert</button></div>');
$(e.item).append('<div class="destroy" style="margin-top: 5px; border: 1px solid darkgray;"><p></p><img class="img-responsive" src="' + formattedB64 + '" /></div>');
$(".insertButton").each(function (e) {
$(this).click(function (d) {
insertImages(imageB64);
});
});
}
else {
FeedBackMessage("No Result For Criteria");
}
});
}
}
else {
$(e.item).find(".destroy").remove();
}
},
collapse: function (e) {
$(e.item).find(".destroy").remove();
}
});
【问题讨论】:
标签: javascript html macos safari