// 初始化整个cleditor的高度,宽度默认大小
$('#textarea-id').cleditor({height: 400});
$("textarea").cleditor();
// 因为cleditor的文本内容在一个frame中,所以要得到$frame设置它的高度
// 但是这样设置有一个问题,就是浏览器的大小以改变,这个$frame的高度又到了默认的250
$('#textarea-id').cleditor()[0].$frame.css('height', '360px');
在官网上看了一下有一个refresh()的方法,但是没有用,这个是在resize的时候调用的
所以只有改源代码了
首先找到jquery.cleditor.js或者jquery.cleditor.min.js,在defaultOptions下面增加一个属性,比如是iheight: 360默认360
然后找到refresh方法下面,有一句话
<iframe frameborder="0" src="javascript:true;" />
把它改成
<iframe style="height: '+editor.options.iheight+'px;" frameborder="0" src="javascript:true;" />
注意:上面的都是jquery.cleditor.js的修改方法
如果是jquery.cleditor.min.js
就搜索:'auto',这里如果是width:'auto'那么就在前面加上iheight: 360
然后再搜索[b]<iframe [/b]加上[b]style="height: '+editor.options.iheight+'px;"[/b]
这里的editor.options要根据前面的参数,有可能是i.options
只要看前面一句是什么.$frame就行了,如果是i.$frame那就是i.options了
最后在使用:
// 初始化整个cleditor的高度,宽度默认大小
$('#textarea-id').cleditor({height: 400, iheight: 360});
$("textarea").cleditor();