/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<!-- ckeditor/config.js --> function e(id){ return document.getElementById(id) } function getWindowHeight() { var elem = (document.compatMode === "CSS1Compat") ? document.documentElement : document.body; return elem.clientHeight; } function calculateOffsetTop(element, opt_top) { var top = opt_top || null; var offset = 0; for(var elem = element; elem && elem != opt_top; elem = elem.offsetParent) { offset += elem.offsetTop; } return offset; } function dynamicEditorHeight() { var window_h = getWindowHeight(); var resizer_height = window_h - calculateOffsetTop(e(document.forms[0].id)); var title_field_h = e("content_title").offsetHeight || 20; var toolbar_h = 62; // double line toolbar var btm_grab_div_h = 21; var submit_btn_h = (document.forms[0].commit) ? document.forms[0].commit.offsetHeight : 0; var padding_h = 60; resizer_height -= (title_field_h + toolbar_h + btm_grab_div_h + submit_btn_h + padding_h + 50); // extra buffer to avoid window scrollbar return(resizer_height); } CKEDITOR.editorConfig = function( config ) { config.height = dynamicEditorHeight(); };