<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How to fix the resize event in IE</title>
	<atom:link href="http://noteslog.com/post/how-to-fix-the-resize-event-in-ie/feed/" rel="self" type="application/rss+xml" />
	<link>http://noteslog.com/post/how-to-fix-the-resize-event-in-ie/</link>
	<description></description>
	<lastBuildDate>Wed, 03 Mar 2010 22:35:54 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Aamir Afridi</title>
		<link>http://noteslog.com/post/how-to-fix-the-resize-event-in-ie/comment-page-2/#comment-42491</link>
		<dc:creator>Aamir Afridi</dc:creator>
		<pubDate>Thu, 17 Dec 2009 10:52:32 +0000</pubDate>
		<guid isPermaLink="false">http://noteslog.com/post/how-to-fix-the-resize-event-in-ie/#comment-42491</guid>
		<description>Hello guys I just discovered another problem which might help you.

I am using jQuery and I have window.resize event to call a function which will re-position the div appended to the body.

Now when I set the LEFT css property of that appended div, the window.resize event get trigger for NO GOOD REASON.

It it results in an infinite loop, triggering the window.resize again and again.

The code without fix:
=============

$(window).resize(function(){
										  
					onResize = function() {
                                               //The method which sets the LEFT css property which triggers window.resize again and it was a infinite loop
						setWrapperPosition($mainWrapper.parent());
					}
						window.clearTimeout(resizeTimeout);
						resizeTimeout = window.setTimeout(onResize, 10);
				});


Solution:
=====

var winWidth = $(window).width(),
winHeight = $(window).height();

$(window).resize(function(){
										  
					onResize = function() {
                                               //The method which sets the LEFT css property which triggers window.resize again and it was a infinite loop
						setWrapperPosition($mainWrapper.parent());
					}
					
                                       //New height and width
					var winNewWidth = $(window).width(),
						winNewHeight = $(window).height();
					
                                       // compare the new height and width with old one
                                       if(winWidth!=winNewWidth &#124;&#124; winHeight!=winNewHeight)
					{
						window.clearTimeout(resizeTimeout);
						resizeTimeout = window.setTimeout(onResize, 10);
					}
					//Update the width and height
					winWidth = winNewWidth;
					winHeight = winNewHeight;
				});


So basically it will check if the height or width is changed (which will happen ONLY when you actually resize with window).</description>
		<content:encoded><![CDATA[<p>Hello guys I just discovered another problem which might help you.</p>
<p>I am using jQuery and I have window.resize event to call a function which will re-position the div appended to the body.</p>
<p>Now when I set the LEFT css property of that appended div, the window.resize event get trigger for NO GOOD REASON.</p>
<p>It it results in an infinite loop, triggering the window.resize again and again.</p>
<p>The code without fix:<br />
=============</p>
<p>$(window).resize(function(){</p>
<p>					onResize = function() {<br />
                                               //The method which sets the LEFT css property which triggers window.resize again and it was a infinite loop<br />
						setWrapperPosition($mainWrapper.parent());<br />
					}<br />
						window.clearTimeout(resizeTimeout);<br />
						resizeTimeout = window.setTimeout(onResize, 10);<br />
				});</p>
<p>Solution:<br />
=====</p>
<p>var winWidth = $(window).width(),<br />
winHeight = $(window).height();</p>
<p>$(window).resize(function(){</p>
<p>					onResize = function() {<br />
                                               //The method which sets the LEFT css property which triggers window.resize again and it was a infinite loop<br />
						setWrapperPosition($mainWrapper.parent());<br />
					}</p>
<p>                                       //New height and width<br />
					var winNewWidth = $(window).width(),<br />
						winNewHeight = $(window).height();</p>
<p>                                       // compare the new height and width with old one<br />
                                       if(winWidth!=winNewWidth || winHeight!=winNewHeight)<br />
					{<br />
						window.clearTimeout(resizeTimeout);<br />
						resizeTimeout = window.setTimeout(onResize, 10);<br />
					}<br />
					//Update the width and height<br />
					winWidth = winNewWidth;<br />
					winHeight = winNewHeight;<br />
				});</p>
<p>So basically it will check if the height or width is changed (which will happen ONLY when you actually resize with window).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: djuRa</title>
		<link>http://noteslog.com/post/how-to-fix-the-resize-event-in-ie/comment-page-2/#comment-42097</link>
		<dc:creator>djuRa</dc:creator>
		<pubDate>Mon, 30 Nov 2009 10:53:53 +0000</pubDate>
		<guid isPermaLink="false">http://noteslog.com/post/how-to-fix-the-resize-event-in-ie/#comment-42097</guid>
		<description>Thanks Hari...Very, Very nice</description>
		<content:encoded><![CDATA[<p>Thanks Hari&#8230;Very, Very nice</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ollie</title>
		<link>http://noteslog.com/post/how-to-fix-the-resize-event-in-ie/comment-page-2/#comment-41936</link>
		<dc:creator>ollie</dc:creator>
		<pubDate>Mon, 23 Nov 2009 14:37:41 +0000</pubDate>
		<guid isPermaLink="false">http://noteslog.com/post/how-to-fix-the-resize-event-in-ie/#comment-41936</guid>
		<description>What a life saver!</description>
		<content:encoded><![CDATA[<p>What a life saver!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hari</title>
		<link>http://noteslog.com/post/how-to-fix-the-resize-event-in-ie/comment-page-2/#comment-41392</link>
		<dc:creator>Hari</dc:creator>
		<pubDate>Fri, 30 Oct 2009 22:54:10 +0000</pubDate>
		<guid isPermaLink="false">http://noteslog.com/post/how-to-fix-the-resize-event-in-ie/#comment-41392</guid>
		<description>My apologies: add the following at the LAST statement of DelayedResize.

window.clearTimeout(windowResizeTimeout);</description>
		<content:encoded><![CDATA[<p>My apologies: add the following at the LAST statement of DelayedResize.</p>
<p>window.clearTimeout(windowResizeTimeout);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hari</title>
		<link>http://noteslog.com/post/how-to-fix-the-resize-event-in-ie/comment-page-2/#comment-41391</link>
		<dc:creator>Hari</dc:creator>
		<pubDate>Fri, 30 Oct 2009 22:41:15 +0000</pubDate>
		<guid isPermaLink="false">http://noteslog.com/post/how-to-fix-the-resize-event-in-ie/#comment-41391</guid>
		<description>I&#039;m sorry if I sound negative, but I think that the following is a way better solution to for those who are looking into NOT executing the same code too many times. The &quot;DelayedResize&quot; method bellow will execute multiple times before user releases the mouse (e.g. drag window size handle, then pause without releasing the mouse), but not even nearly as many times as the onResize fires by default. And, this does not change Mozilla&#039;s behavior at all.


$(document).ready(function()
{
    var tempCounter = 0;
    var windowResizeTimeout;

    window.onresize = function()
    {
        window.clearTimeout(windowResizeTimeout);
        windowResizeTimeout = window.setTimeout(DelayedResize, 100);
    };

    function DelayedResize()
    {
        window.status = ++tempCounter;
        // Add your original window.onresize implementation here
    }
}</description>
		<content:encoded><![CDATA[<p>I&#8217;m sorry if I sound negative, but I think that the following is a way better solution to for those who are looking into NOT executing the same code too many times. The &#8220;DelayedResize&#8221; method bellow will execute multiple times before user releases the mouse (e.g. drag window size handle, then pause without releasing the mouse), but not even nearly as many times as the onResize fires by default. And, this does not change Mozilla&#8217;s behavior at all.</p>
<p>$(document).ready(function()<br />
{<br />
    var tempCounter = 0;<br />
    var windowResizeTimeout;</p>
<p>    window.onresize = function()<br />
    {<br />
        window.clearTimeout(windowResizeTimeout);<br />
        windowResizeTimeout = window.setTimeout(DelayedResize, 100);<br />
    };</p>
<p>    function DelayedResize()<br />
    {<br />
        window.status = ++tempCounter;<br />
        // Add your original window.onresize implementation here<br />
    }<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://noteslog.com/post/how-to-fix-the-resize-event-in-ie/comment-page-2/#comment-40473</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Sun, 27 Sep 2009 15:33:16 +0000</pubDate>
		<guid isPermaLink="false">http://noteslog.com/post/how-to-fix-the-resize-event-in-ie/#comment-40473</guid>
		<description>Great plugin. Saved me from a serious headache with IE/FF resizing! I did have some trouble copying and pasting your code. Whatever you&#039;re using to display code on this page is a bit buggy. Thanks again!</description>
		<content:encoded><![CDATA[<p>Great plugin. Saved me from a serious headache with IE/FF resizing! I did have some trouble copying and pasting your code. Whatever you&#8217;re using to display code on this page is a bit buggy. Thanks again!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cujo</title>
		<link>http://noteslog.com/post/how-to-fix-the-resize-event-in-ie/comment-page-2/#comment-38761</link>
		<dc:creator>Cujo</dc:creator>
		<pubDate>Sat, 25 Jul 2009 12:25:18 +0000</pubDate>
		<guid isPermaLink="false">http://noteslog.com/post/how-to-fix-the-resize-event-in-ie/#comment-38761</guid>
		<description>I&#039;m also not sure I understand how this is supposed to work. I&#039;m developing a plugin for generic resizing (of windows, images, etc.). When I enter the plugin using the regular jQuery event handler method -- $(selector).resize(function(){...$(selector).plugin(options)...} -- jQuery gives a &quot;this&quot; object with at least one member. If instead I enter the plugin using wresize -- $(selector).wresize($(selector).plugin(options)) -- the plugin sees a &quot;this&quot; object with this.length == 0. Shouldn&#039;t the plugin get identical &quot;this&quot; objects from jquery&#039;s resize and wresize?</description>
		<content:encoded><![CDATA[<p>I&#8217;m also not sure I understand how this is supposed to work. I&#8217;m developing a plugin for generic resizing (of windows, images, etc.). When I enter the plugin using the regular jQuery event handler method &#8212; $(selector).resize(function(){&#8230;$(selector).plugin(options)&#8230;} &#8212; jQuery gives a &#8220;this&#8221; object with at least one member. If instead I enter the plugin using wresize &#8212; $(selector).wresize($(selector).plugin(options)) &#8212; the plugin sees a &#8220;this&#8221; object with this.length == 0. Shouldn&#8217;t the plugin get identical &#8220;this&#8221; objects from jquery&#8217;s resize and wresize?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hugh</title>
		<link>http://noteslog.com/post/how-to-fix-the-resize-event-in-ie/comment-page-2/#comment-37755</link>
		<dc:creator>Hugh</dc:creator>
		<pubDate>Wed, 17 Jun 2009 16:04:51 +0000</pubDate>
		<guid isPermaLink="false">http://noteslog.com/post/how-to-fix-the-resize-event-in-ie/#comment-37755</guid>
		<description>ABSOLUTELY BRILLIANT!
I have been trying to work around the IE Resize Bug many times, many hours and for many different projects!
Finally, thanks to you, I have a solution which I can tailor for every need!!!
I really owe my thanks to you and hope that others find it as useful as I did!</description>
		<content:encoded><![CDATA[<p>ABSOLUTELY BRILLIANT!<br />
I have been trying to work around the IE Resize Bug many times, many hours and for many different projects!<br />
Finally, thanks to you, I have a solution which I can tailor for every need!!!<br />
I really owe my thanks to you and hope that others find it as useful as I did!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steven</title>
		<link>http://noteslog.com/post/how-to-fix-the-resize-event-in-ie/comment-page-2/#comment-37129</link>
		<dc:creator>Steven</dc:creator>
		<pubDate>Fri, 29 May 2009 15:29:39 +0000</pubDate>
		<guid isPermaLink="false">http://noteslog.com/post/how-to-fix-the-resize-event-in-ie/#comment-37129</guid>
		<description>thanks</description>
		<content:encoded><![CDATA[<p>thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Raymond Shaw</title>
		<link>http://noteslog.com/post/how-to-fix-the-resize-event-in-ie/comment-page-2/#comment-35718</link>
		<dc:creator>Raymond Shaw</dc:creator>
		<pubDate>Mon, 30 Mar 2009 20:51:00 +0000</pubDate>
		<guid isPermaLink="false">http://noteslog.com/post/how-to-fix-the-resize-event-in-ie/#comment-35718</guid>
		<description>Thank you :)</description>
		<content:encoded><![CDATA[<p>Thank you :)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
