因此,单击按钮后,我想显示一个包含指向 youtube 链接的灯箱。
我在我的项目中使用 requirejs 和 lightbox,但出现错误:“未捕获的 TypeError:对象函数 (e,t){return new x.fn.init(e,t,r)} has no method 'colorbox'”
我认为该功能找不到 Colorbox,但我不知道为什么。
这是我的文件:openYoutubeLink:
define( [ 'modules/common/preferences' ], function ( preferences ) {
return function () {
$.colorbox({width:"900px", height:"600px", iframe:true, href:"youtube.de"});
};
});
这是我的 main.js 的一部分,带有 require.config:
paths: {
colorbox : 'libs/jquery/jquery.colorbox-min'
}
shim: {
'colorbox' : { deps: [ 'jquery' ], exports: 'jquery' }
}