我已经创建了这样的自定义按钮
setup: function (ed) {
ed.addButton('fancybox_button', {
title: 'Fancybox button',
image: 'img/button.gif',
onclick: function() {
fancybox_button();
}
});
}
这有效,并且按钮出现在工具栏中。接下来,在tinyMCE.init之前我有类似的fancybox_button函数
function fancybox_button() {
$.fancybox({
padding : 0,
minHeight : 560,
minWidth : 950,
...
});
}
通过单击自定义按钮,我将收到此错误
Uncaught TypeError: Object function ( selector, context ) {
// The jQuery object is actually just the init constructor 'enhanced'
return new jQuery.fn.init( selector, context, rootjQuery );
} has no method 'fancybox'
我该怎么做对?
最佳答案
我假设jquery在您的页面上,因为有关该错误的讨论,所以看来fancybox js脚本丢失了,或者您的fancybox js脚本声明放在页面中jquery的上方。
关于jquery - 如何使用自定义按钮在tinyMCE中打开fancybox,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/12971148/