JavaScript window resize

Posted by Happy on Stack Overflow See other posts from Stack Overflow or by Happy
Published on 2010-05-13T08:51:42Z Indexed on 2010/05/13 8:54 UTC
Read the original article Hit count: 539

Filed under:
|

I have piece of javascript code, which should process when the browser window is resized.

var resize=$('div.resize',$(this).parent())[0];
resize.style.marginRight=(resize.offsetWidth-$(this)[0].offsetWidth)+'px'

Tryed this stuff (doesn't work):

var resize=$('div.resize',$(this).parent())[0];
window.onresize = function(event) {
resize.style.marginRight=(resize.offsetWidth-$(this)[0].offsetWidth)+'px'
}

Thanks.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about resize