javascript events - cross-browser element onresize (HTML / JS) -


i know ie supports onresize event element while firefox suporty for window object only.

since need functionality modern browser using (fairly fast) interval timer continously checks clientwidth/clientheight of element emulate onresize. of course inefficient , i'd know if there cross-browser way this. or, alternatively, different methods work in ff/webkit/ie timer-method can used fallback remaining browsers.

targeting @ plain javascript, instead of jquery / prototype etc.

if don't want use jquery must check browser sends your's script, so:

if(!element.onresize != null) element.onresize += event; if(!element.onresizeanotherhandler != null) element.onresizeanotherhandler += event; 

i don't know easy, general concept.

edit: looks there not event handler firefox. there trick:

  • if changing width in your's js create function update

    function update(var nx, var ny){     // nx , ny } 
  • if added resize handle using css using javascript

  • if using 80% in your's css handle window.onresize:

    function resize(){     alert(document.getelementbyid("test").style.width); } 

    window.onresize = resize;

it looks there no other way.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -