Dynamic width

Mar 5, 2014 at 2:12 PM
Just for future reference, I'm leaving this note.

I was trying to figure out how to get the editor to resize its width dynamically when the window resizes. (I have the editor contained in a table with width=100%.) To get the editor to resize when the window resizes, I did the following:

For the textarea element in the HTML, don't specify any width in the style attribute.

In the stylesheets, put:
div.jHtmlArea {
    width: 100% !important;
}
And in the Javascript:
$(document).ready(init);

function init() {
    resizeHtmlEditor();
    $(window).resize(resizeHtmlEditor);
}

function resizeHtmlEditor() {
    $('div.jHtmlArea').find('div.ToolBar').css('width', '100%');
    $('div.jHtmlArea iframe').css('width', '100%');
}