我正在使用 NicEditor ( http://nicedit.com )。
首先,我将文本区域的宽度设置为 100%,但是当我调整窗口大小时,编辑器保持不变,不会调整到新的 100% 窗口宽度。
<textarea style="width: 100%;"> something .. </textarea>
<script>
//<![CDATA[
bkLib.onDomLoaded(function() { nicEditors.allTextAreas() });
//]]>
</script>
我该如何解决这个问题?
编辑: 我找到了一个有效的解决方案:
$(function () {
editor = new nicEditor({fullPanel : false}).panelInstance('text');
})
$(window).resize(function() {
editor.removeInstance('text');
editor = new nicEditor({fullPanel : false}).panelInstance('text');
});
最佳答案
默认情况下,Nice Editor 或 CK Editor 没有响应功能。
试试下面这样的东西。通过父元素控制宽度和高度。
<textarea id="comments" style="width:100%; height:100%;"></textarea>
每次调整窗口大小时,调用 NiceEdit
JS:
var editor;
function reLoadEditor() {
editor.removeInstance('comments');
editor = new nicEditor({fullPanel : false}).panelInstance('comments');
}();
$(window).resize( function() {
reLoadEditor();
} );
引用 - 演示 3:添加/删除 NicEditors:
http://nicedit.com/demos.php?demo=3
关于jquery - 使用 NicEditor 调整窗口大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34578695/