<?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: CSS Image Replacement for iPhone 4 High-DPI Retina Display</title>
	<atom:link href="http://flowz.com/2010/07/css-image-replacement-for-iphone-4-high-dpi-retina-display/feed/" rel="self" type="application/rss+xml" />
	<link>http://flowz.com/2010/07/css-image-replacement-for-iphone-4-high-dpi-retina-display/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=css-image-replacement-for-iphone-4-high-dpi-retina-display</link>
	<description>Our brain goo cup overfloweth</description>
	<lastBuildDate>Tue, 08 May 2012 12:50:13 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
	<item>
		<title>By: Chad Weider &#187; Quick and Dirty High-DPI Images</title>
		<link>http://flowz.com/2010/07/css-image-replacement-for-iphone-4-high-dpi-retina-display/comment-page-1/#comment-13059</link>
		<dc:creator>Chad Weider &#187; Quick and Dirty High-DPI Images</dc:creator>
		<pubDate>Mon, 16 Apr 2012 20:59:50 +0000</pubDate>
		<guid isPermaLink="false">http://flowz.com/?p=920#comment-13059</guid>
		<description>[...] isn’t an unrecognized problem and it has been solved elsewhere, but the accepted approach seems require JavaScript and class names, which strikes me as [...]</description>
		<content:encoded><![CDATA[<p>[...] isn’t an unrecognized problem and it has been solved elsewhere, but the accepted approach seems require JavaScript and class names, which strikes me as [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Leon Smith</title>
		<link>http://flowz.com/2010/07/css-image-replacement-for-iphone-4-high-dpi-retina-display/comment-page-1/#comment-12918</link>
		<dc:creator>Leon Smith</dc:creator>
		<pubDate>Sun, 01 Apr 2012 12:57:25 +0000</pubDate>
		<guid isPermaLink="false">http://flowz.com/?p=920#comment-12918</guid>
		<description>Excellent article Mike,

I took the same approach when i was trying to figure out how to implement retina support on hi DPI devices but bundled it all into a jQuery plugin.

https://github.com/leonsmith/retina-replace-js</description>
		<content:encoded><![CDATA[<p>Excellent article Mike,</p>
<p>I took the same approach when i was trying to figure out how to implement retina support on hi DPI devices but bundled it all into a jQuery plugin.</p>
<p><a href="https://github.com/leonsmith/retina-replace-js" rel="nofollow">https://github.com/leonsmith/retina-replace-js</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Grappa</title>
		<link>http://flowz.com/2010/07/css-image-replacement-for-iphone-4-high-dpi-retina-display/comment-page-1/#comment-12806</link>
		<dc:creator>Grappa</dc:creator>
		<pubDate>Tue, 20 Mar 2012 17:44:53 +0000</pubDate>
		<guid isPermaLink="false">http://flowz.com/?p=920#comment-12806</guid>
		<description>The 2 Blue Images above looks on my iPad (3) absolutly identic.
No, my eyes are ok :-)</description>
		<content:encoded><![CDATA[<p>The 2 Blue Images above looks on my iPad (3) absolutly identic.<br />
No, my eyes are ok <img src='http://flowz.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brett Jankord</title>
		<link>http://flowz.com/2010/07/css-image-replacement-for-iphone-4-high-dpi-retina-display/comment-page-1/#comment-12745</link>
		<dc:creator>Brett Jankord</dc:creator>
		<pubDate>Thu, 15 Mar 2012 16:12:58 +0000</pubDate>
		<guid isPermaLink="false">http://flowz.com/?p=920#comment-12745</guid>
		<description>Brain Cray wrote this little snippet of code to detect retina displays.
var retina = window.devicePixelRatio &gt; 1 ? true : false;

http://briancray.com/2011/05/05/detect-retina-displays-with-javascript/

I&#039;ve pieced that together with the code your wrote below:

function highdpi_init() {
	// Feature detect for hi-res devices
	var hiRes = window.devicePixelRatio &gt; 1 ? true : false;
	// Replace imgs with hi-res version .hi-res class is detected
	if (hiRes) {
		var els = jQuery(&quot;.hi-res&quot;).get();
		for(var i = 0; i &lt; els.length; i++) {
			var src = els[i].src
			//alert(src);
			src = src.replace(&quot;.jpg&quot;, &quot;@2x.jpg&quot;);
			src = src.replace(&quot;.png&quot;, &quot;@2x.png&quot;);
			src = src.replace(&quot;.gif&quot;, &quot;@2x.gif&quot;);
			els[i].src = src;
		}
	}
}

$(document).ready(function() {
	highdpi_init();	
});

This seems to work on the iPhone 4S, will test on the new iPad tomorrow.</description>
		<content:encoded><![CDATA[<p>Brain Cray wrote this little snippet of code to detect retina displays.<br />
var retina = window.devicePixelRatio &gt; 1 ? true : false;</p>
<p><a href="http://briancray.com/2011/05/05/detect-retina-displays-with-javascript/" rel="nofollow">http://briancray.com/2011/05/05/detect-retina-displays-with-javascript/</a></p>
<p>I&#8217;ve pieced that together with the code your wrote below:</p>
<p>function highdpi_init() {<br />
	// Feature detect for hi-res devices<br />
	var hiRes = window.devicePixelRatio &gt; 1 ? true : false;<br />
	// Replace imgs with hi-res version .hi-res class is detected<br />
	if (hiRes) {<br />
		var els = jQuery(&#8220;.hi-res&#8221;).get();<br />
		for(var i = 0; i &lt; els.length; i++) {<br />
			var src = els[i].src<br />
			//alert(src);<br />
			src = src.replace(&quot;.jpg&quot;, &quot;@2x.jpg&quot;);<br />
			src = src.replace(&quot;.png&quot;, &quot;@2x.png&quot;);<br />
			src = src.replace(&quot;.gif&quot;, &quot;@2x.gif&quot;);<br />
			els[i].src = src;<br />
		}<br />
	}<br />
}</p>
<p>$(document).ready(function() {<br />
	highdpi_init();<br />
});</p>
<p>This seems to work on the iPhone 4S, will test on the new iPad tomorrow.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Madhava Jay</title>
		<link>http://flowz.com/2010/07/css-image-replacement-for-iphone-4-high-dpi-retina-display/comment-page-1/#comment-12737</link>
		<dc:creator>Madhava Jay</dc:creator>
		<pubDate>Thu, 15 Mar 2012 02:43:38 +0000</pubDate>
		<guid isPermaLink="false">http://flowz.com/?p=920#comment-12737</guid>
		<description>I successfully implemented this method on this site: http://www.mynextwine.com.au, Mobile website only displays on mobile devices.

The trick was to not actually have ANY images load by setting the img src to empty and having another param called url and put the original src value in there. Then I gave them the class retina if they had retina replacements and used this JS:

$(&#039;.retina&#039;).each(function() {
			var el = $(this);
			var src = el.attr(&#039;url&#039;);
			if (el.css(&#039;font-size&#039;) == &#039;1px&#039;) {
				src = src.replace(&#039;.png&#039;, &#039;@2x.png&#039;);
			}
			el.attr(&#039;src&#039;, src);
		});

The result is it only fetches the correct image and surprisingly it happens quickly.

Also to avoid using jQuery on mobile I used Zepto.js which still gives me the $.jQuery style selectors.

Its snappy and works great. :)
The only trick is to make sure you put in those original non retina widths in your img tag.</description>
		<content:encoded><![CDATA[<p>I successfully implemented this method on this site: <a href="http://www.mynextwine.com.au" rel="nofollow">http://www.mynextwine.com.au</a>, Mobile website only displays on mobile devices.</p>
<p>The trick was to not actually have ANY images load by setting the img src to empty and having another param called url and put the original src value in there. Then I gave them the class retina if they had retina replacements and used this JS:</p>
<p>$(&#8216;.retina&#8217;).each(function() {<br />
			var el = $(this);<br />
			var src = el.attr(&#8216;url&#8217;);<br />
			if (el.css(&#8216;font-size&#8217;) == &#8217;1px&#8217;) {<br />
				src = src.replace(&#8216;.png&#8217;, &#8216;@2x.png&#8217;);<br />
			}<br />
			el.attr(&#8216;src&#8217;, src);<br />
		});</p>
<p>The result is it only fetches the correct image and surprisingly it happens quickly.</p>
<p>Also to avoid using jQuery on mobile I used Zepto.js which still gives me the $.jQuery style selectors.</p>
<p>Its snappy and works great. <img src='http://flowz.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
The only trick is to make sure you put in those original non retina widths in your img tag.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Retina Display 的 CSS 寫法 &#124; Waking Life</title>
		<link>http://flowz.com/2010/07/css-image-replacement-for-iphone-4-high-dpi-retina-display/comment-page-1/#comment-12669</link>
		<dc:creator>Retina Display 的 CSS 寫法 &#124; Waking Life</dc:creator>
		<pubDate>Fri, 09 Mar 2012 06:30:56 +0000</pubDate>
		<guid isPermaLink="false">http://flowz.com/?p=920#comment-12669</guid>
		<description>[...] 這我不太理解，可能是方便寫程式去自動取代之類的 ex. http://flowz.com/2010/07/css-image-replacement-for-iphone-4-high-dpi-retina-display/ 。等之後有空再來研究一下。     [...]</description>
		<content:encoded><![CDATA[<p>[...] 這我不太理解，可能是方便寫程式去自動取代之類的 ex. http://flowz.com/2010/07/css-image-replacement-for-iphone-4-high-dpi-retina-display/ 。等之後有空再來研究一下。     [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: How to serve high-resolution website images for retina displays (new iPad/iPhone4) - benfrain.com - blog of technology writer and web designer Ben Frain.</title>
		<link>http://flowz.com/2010/07/css-image-replacement-for-iphone-4-high-dpi-retina-display/comment-page-1/#comment-12666</link>
		<dc:creator>How to serve high-resolution website images for retina displays (new iPad/iPhone4) - benfrain.com - blog of technology writer and web designer Ben Frain.</dc:creator>
		<pubDate>Thu, 08 Mar 2012 17:26:12 +0000</pubDate>
		<guid isPermaLink="false">http://flowz.com/?p=920#comment-12666</guid>
		<description>[...] Sadly, at present there is no &#8216;normal&#8217; way to do this purely through markup. There are JavaScript solutions (such as this one at Flowz) that are relatively simple to implement. Modernizr may also be able to help with this kind of [...]</description>
		<content:encoded><![CDATA[<p>[...] Sadly, at present there is no &#8216;normal&#8217; way to do this purely through markup. There are JavaScript solutions (such as this one at Flowz) that are relatively simple to implement. Modernizr may also be able to help with this kind of [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim Bannister</title>
		<link>http://flowz.com/2010/07/css-image-replacement-for-iphone-4-high-dpi-retina-display/comment-page-1/#comment-12626</link>
		<dc:creator>Tim Bannister</dc:creator>
		<pubDate>Sat, 03 Mar 2012 12:16:09 +0000</pubDate>
		<guid isPermaLink="false">http://flowz.com/?p=920#comment-12626</guid>
		<description>With XMLHTTPRequest, the client-side code could actually do a lazy (asynchronous) check for the high-resolution replacement images, and update the page whereever it finds one. It&#039;s a lot more coding though, and wouldn&#039;t suit high traffic websites.</description>
		<content:encoded><![CDATA[<p>With XMLHTTPRequest, the client-side code could actually do a lazy (asynchronous) check for the high-resolution replacement images, and update the page whereever it finds one. It&#8217;s a lot more coding though, and wouldn&#8217;t suit high traffic websites.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ash Connell</title>
		<link>http://flowz.com/2010/07/css-image-replacement-for-iphone-4-high-dpi-retina-display/comment-page-1/#comment-12607</link>
		<dc:creator>Ash Connell</dc:creator>
		<pubDate>Fri, 02 Mar 2012 01:17:13 +0000</pubDate>
		<guid isPermaLink="false">http://flowz.com/?p=920#comment-12607</guid>
		<description>Would it not be better to run the @2x replacement script before the document is ready in order to stop loading the original sized image?</description>
		<content:encoded><![CDATA[<p>Would it not be better to run the @2x replacement script before the document is ready in order to stop loading the original sized image?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Wille</title>
		<link>http://flowz.com/2010/07/css-image-replacement-for-iphone-4-high-dpi-retina-display/comment-page-1/#comment-11953</link>
		<dc:creator>Mike Wille</dc:creator>
		<pubDate>Mon, 09 Jan 2012 22:02:13 +0000</pubDate>
		<guid isPermaLink="false">http://flowz.com/?p=920#comment-11953</guid>
		<description>@amy:

The function, highdpi_init(), is being called no matter what.  However, the code that actually does the image replacement is only executed if the retina.css file is loaded.  This line here:

   if(jQuery(&#039;.replace-2x&#039;).css(&#039;font-size&#039;) == &quot;1px&quot;) {

Will only evaluate to true if retina.css was included.

HTH.</description>
		<content:encoded><![CDATA[<p>@amy:</p>
<p>The function, highdpi_init(), is being called no matter what.  However, the code that actually does the image replacement is only executed if the retina.css file is loaded.  This line here:</p>
<p>   if(jQuery(&#8216;.replace-2x&#8217;).css(&#8216;font-size&#8217;) == &#8220;1px&#8221;) {</p>
<p>Will only evaluate to true if retina.css was included.</p>
<p>HTH.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

