开发者

OnResize Event for all browsers?

开发者 https://www.devze.com 2022-12-25 12:51 出处:网络
I was wondering if there was to fire an event upon the resizing of the window that would work for all browsers. Any help would be appreciated.

I was wondering if there was to fire an event upon the resizing of the window that would work for all browsers. Any help would be appreciated.

Th开发者_如何转开发anks in advance.


jQuery, as usual, has a cross-browser resize event.


This should answer your question:

<script type="text/javascript">
    window.onresize = function () {
       <!-- YOUR CODE WILL GO HEAR -->
    }
</script>


You can try document.body.onresize=function(){//your code}.

I don't have opera. I have tested this on IE 9 and chrome.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号