<?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>Web Style Press, Best Practices from all the Web, Build Better Websites &#187; window</title>
	<atom:link href="http://www.webstylepress.com/tag/window/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.webstylepress.com</link>
	<description>Web VS Style</description>
	<lastBuildDate>Mon, 26 Dec 2011 10:35:53 +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>Auto Resize Browser Window To Image Size</title>
		<link>http://www.webstylepress.com/auto-resize-browser-window-to-image-size/</link>
		<comments>http://www.webstylepress.com/auto-resize-browser-window-to-image-size/#comments</comments>
		<pubDate>Sat, 27 Sep 2008 00:32:48 +0000</pubDate>
		<dc:creator>Hiroshi</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Tricks]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[window]]></category>

		<guid isPermaLink="false">http://www.webstylepress.com/?p=100</guid>
		<description><![CDATA[This script is typically best for pop-up windows where you want to display random images on request. It will allow browser window to auto-fit according to the image size. Add this script into head section of web page: &#60;script language=&#34;javascript&#34;&#62; &#60;!-- var i=0; function resize&#40;&#41; &#123; if &#40;navigator.appName == 'Netscape'&#41; i=40; if &#40;document.images&#91;0&#93;&#41; window.resizeTo&#40;document.images&#91;0&#93;.width +30, [...]<p><a href="http://www.webstylepress.com/auto-resize-browser-window-to-image-size/">Auto Resize Browser Window To Image Size</a> is a post from: <a href="http://www.webstylepress.com">Web Style Press, Best Practices from all the Web, Build Better Websites</a></p>
]]></description>
			<content:encoded><![CDATA[<p>This script is typically best for pop-up windows where you want to display random images on request. It will allow browser window to auto-fit according to the image size.</p>
<p><span id="more-100"></span></p>
<p>Add this script into <strong>head</strong> section of web page:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script language<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;javascript&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;!--</span>
<span style="color: #003366; font-weight: bold;">var</span> i<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">function</span> resize<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>navigator.<span style="color: #660066;">appName</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">'Netscape'</span><span style="color: #009900;">&#41;</span> i<span style="color: #339933;">=</span><span style="color: #CC0000;">40</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">images</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> window.<span style="color: #660066;">resizeTo</span><span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">images</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">width</span> <span style="color: #339933;">+</span><span style="color: #CC0000;">30</span><span style="color: #339933;">,</span> document.<span style="color: #660066;">images</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">height</span><span style="color: #339933;">+</span><span style="color: #CC0000;">80</span><span style="color: #339933;">-</span>i<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  self.<span style="color: #000066;">focus</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  self.<span style="color: #660066;">moveTo</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">170</span><span style="color: #339933;">,</span><span style="color: #CC0000;">50</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #006600; font-style: italic;">//--&gt;&lt;/script&gt;</span></pre></div></div>

<p>We just wrote a function named as <strong>resize</strong>. Call this function in the <strong>body tag</strong> of the popup page.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;body onload=&quot;resize();&quot;&gt;</pre></div></div>

<p>This function will serve the purpose and on page load it will look for the image size and will resize the browser window according to the image size.</p>
<p>This script is for popup page at which image is placed. Call the popup page with no toolbar or menubar as decsribed below:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;a href=&quot;#&quot; onClick=&quot;window.open('popup-page.html', '', 'toolbar=0,menubar=0,location=0,left=0,top=113,screenX=0,screenY=100,scrollbars=yes'); return false;&quot;&gt;Launch popup&lt;/a&gt;</pre></div></div>

<p><a href='http://www.webstylepress.com/wp-content/uploads/2008/09/window-resize-to-image-size.rar'>Download Window Resize Script</a></p>
<p><a href="http://www.webstylepress.com/auto-resize-browser-window-to-image-size/">Auto Resize Browser Window To Image Size</a> is a post from: <a href="http://www.webstylepress.com">Web Style Press, Best Practices from all the Web, Build Better Websites</a></p>
<h2  class="related_post_title">Related Posts</h2><ul class="related_post"><li><a href="http://www.webstylepress.com/use-any-font-in-webpages-as-text/" title="Use Any Font in Webpages As Text">Use Any Font in Webpages As Text</a></li><li><a href="http://www.webstylepress.com/simple-rollover-swap-image/" title="Simple RollOver Swap Image">Simple RollOver Swap Image</a></li><li><a href="http://www.webstylepress.com/change-image-opacity-easily-using-css-js/" title="Change Image Opacity Easily Using CSS or JS">Change Image Opacity Easily Using CSS or JS</a></li><li><a href="http://www.webstylepress.com/advanced-js-calendar/" title="Advanced JS Calendar">Advanced JS Calendar</a></li><li><a href="http://www.webstylepress.com/simple-js-calendar/" title="Create Simple Javascript Based Calendar">Create Simple Javascript Based Calendar</a></li><li><a href="http://www.webstylepress.com/javascript-essentials-part-6/" title="Javascript Essentials Part 6">Javascript Essentials Part 6</a></li><li><a href="http://www.webstylepress.com/javascript-essentials-part-5/" title="Javascript Essentials Part 5">Javascript Essentials Part 5</a></li><li><a href="http://www.webstylepress.com/javascript-essentials-part-4/" title="Javascript Essentials Part 4">Javascript Essentials Part 4</a></li><li><a href="http://www.webstylepress.com/javascript-essentials-part-3/" title="Javascript Essentials Part 3">Javascript Essentials Part 3</a></li><li><a href="http://www.webstylepress.com/javascript-essentials-part-2/" title="Javascript Essentials Part 2">Javascript Essentials Part 2</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.webstylepress.com/auto-resize-browser-window-to-image-size/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

