Log in or register to post comments
Last post
nitesh's picture
Joined: 12/06/2008
Posts: 27
Table resize event
Is there an event that occurs when the table in the editor is resized that I can hook into? Needs to work for both IE6 and IE7.

Cheers
nitesh's picture
Joined: 12/06/2008
Posts: 27
Re: Table resize event
I figured out the answer to this, but only for IE6/IE7:

You need to add a CSS behaviour to the table, and attach a handler to the resize event in there:

Example code to force table resize to use %

editor/_source/internals/fck_ie.js; add something like:
sTableBehavior += ' url(' + sBasePath + 'css/behaviors/tableresizeaspercent.htc)' ;


add a new file: editor/css/behaviors/tableresizeaspercent.htc
<public:component lightweight="true">

<public:attach event="onresizeend" onevent="resizeAsPercent()" />

<script language="javascript">

function resizeAsPercent()
{    
    // Use parent body width and current width to determine % width
    var oNode = this ;
    while ( oNode && oNode.nodeName != 'BODY' )
        oNode = oNode.parentNode ;
    
    this.width = this.style.width = parseInt( ( this.offsetWidth / ( parseInt( oNode.clientWidth ) - 30 ) ) * 100 ) + '%' ;
}

</script>

</public:component>



I would be grateful to anyone who can figure out how to do this in Firefox 3 too.

Cheers