<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Bits, Bytes And Burps &#187; javascript</title>
	<atom:link href="http://www.brainyautomation.com/blog/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.brainyautomation.com/blog</link>
	<description>Tech Ramblings of a Confused Mind...</description>
	<lastBuildDate>Wed, 16 Mar 2011 20:57:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Nice javascript to set window size for popups</title>
		<link>http://www.brainyautomation.com/blog/2010/02/14/nice-javascript-to-set-window-size-for-popups/</link>
		<comments>http://www.brainyautomation.com/blog/2010/02/14/nice-javascript-to-set-window-size-for-popups/#comments</comments>
		<pubDate>Sun, 14 Feb 2010 07:06:00 +0000</pubDate>
		<dc:creator>steven</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">/blog/post/Nice-javascript-to-set-window-size-for-popups.aspx</guid>
		<description><![CDATA[This is some spiffy javascript to get the proper sizes of the window for say a nifty colorbox popup; var<a href="http://www.brainyautomation.com/blog/2010/02/14/nice-javascript-to-set-window-size-for-popups/" class="searchmore">Read the Rest...</a><div class="clr"></div>]]></description>
			<content:encoded><![CDATA[<p>This is some spiffy javascript to get the proper sizes of the window for say a nifty colorbox popup;</p>
<pre name="code" class="javascript">
    var myWidth = 0, myHeight = 0;</span>
    function setWindowSize() {
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} else if( document.documentElement &amp;&amp; ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if( document.body &amp;&amp; ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
};</pre>
<p>An example of using it is like this;</p>
<pre name="code" class="javascript">
$.fn.colorbox({
    iframe: true,
    open: true,
    href: '/Controller/Action',
    width: myWidth - 40, // just a bit smaller than the window
    height: myHeight - 40 // just a bit smaller than the window
});
</pre>
<p>Dont forget to bind the window resize to reset your size variables;</p>
<pre name="code" class="js">
$(window).resize(function(e){
    setWindowSize();
});
</pre>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.brainyautomation.com/blog/2010/02/14/nice-javascript-to-set-window-size-for-popups/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

