燈箱假定該文件是一個圖像,從而增加了在內部的<img />
標籤href屬性,而對話框沒有,因此,使用內容的需求屬性,包括手動改爲<img />
標籤。根據您想達到什麼樣的,你有幾種選擇(增加的複雜性/ fancyness):
用的contentPane:
require(['dijit/layout/ContentPane'], function (ContentPane) {
var theImage = new ContentPane({content: '<img src="yourimageurl"/>'}, 'theImage');
theImage.startup();
});
與對話(擴展的contentPane):
require(['dijit/Dialog'], function (Dialog) {
var theImage = new Dialog({title: 'the image', content: '<img src="yourimageurl"/>'});
theImage.startup();
theImage.show();
});
與燈箱(需要Lightbox css,使用擴展Dialog的LightboxDialog):
require(['dojox/image/Lightbox'], function (Lightbox) {
var theImage = new Lightbox({title: 'the image', href: 'yourimageurl'});
theImage.startup();
theImage.show();
});
with LightboxDialog(idem Lightbox,展示LightboxDialog實例):
require(['dojox/image/Lightbox'], function (Lightbox) {
var theDialog = new dojox.image.LightboxDialog({});
theDialog.startup();
theDialog.show({title: 'the image', href: 'yourimageurl'});
});
您是否嘗試設置內容? –