<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.2.2" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Automatic image captions with unobtrusive JavaScript</title>
	<link>http://www.xaprb.com/blog/2006/10/29/automatic-image-captions-with-unobtrusive-javascript/</link>
	<description>Stay curious!</description>
	<pubDate>Sun, 20 Jul 2008 22:47:08 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.2</generator>

	<item>
		<title>By: Propiedad Privada &#187; Blog Archive &#187; De web varia</title>
		<link>http://www.xaprb.com/blog/2006/10/29/automatic-image-captions-with-unobtrusive-javascript/#comment-12023</link>
		<author>Propiedad Privada &#187; Blog Archive &#187; De web varia</author>
		<pubDate>Tue, 03 Jul 2007 09:42:28 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/10/29/automatic-image-captions-with-unobtrusive-javascript/#comment-12023</guid>
		<description>[...] Descripciones automáticas en nuestra imágenes con javascript no obstrusivo es lo que nos ofrece Xaprb [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] Descripciones automáticas en nuestra imágenes con javascript no obstrusivo es lo que nos ofrece Xaprb [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Justin Gehring</title>
		<link>http://www.xaprb.com/blog/2006/10/29/automatic-image-captions-with-unobtrusive-javascript/#comment-5198</link>
		<author>Justin Gehring</author>
		<pubDate>Thu, 22 Mar 2007 21:58:41 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/10/29/automatic-image-captions-with-unobtrusive-javascript/#comment-5198</guid>
		<description>&lt;p&gt;There's a pre-packaged version of this that works fairly well at http://www.quickcapt.com/&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>There&#8217;s a pre-packaged version of this that works fairly well at <a href="http://www.quickcapt.com/" rel="nofollow">http://www.quickcapt.com/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Xaprb</title>
		<link>http://www.xaprb.com/blog/2006/10/29/automatic-image-captions-with-unobtrusive-javascript/#comment-2894</link>
		<author>Xaprb</author>
		<pubDate>Sat, 23 Dec 2006 22:46:40 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/10/29/automatic-image-captions-with-unobtrusive-javascript/#comment-2894</guid>
		<description>&lt;p&gt;I wonder if it has to do with doctype and standards mode.&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>I wonder if it has to do with doctype and standards mode.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul Adler</title>
		<link>http://www.xaprb.com/blog/2006/10/29/automatic-image-captions-with-unobtrusive-javascript/#comment-2893</link>
		<author>Paul Adler</author>
		<pubDate>Sat, 23 Dec 2006 22:35:34 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/10/29/automatic-image-captions-with-unobtrusive-javascript/#comment-2893</guid>
		<description>&lt;p&gt;Still has the same problems in ie 6 and 7.  There is no change.  Very strange, because it works fine for me from my code.&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Still has the same problems in ie 6 and 7.  There is no change.  Very strange, because it works fine for me from my code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Xaprb</title>
		<link>http://www.xaprb.com/blog/2006/10/29/automatic-image-captions-with-unobtrusive-javascript/#comment-2888</link>
		<author>Xaprb</author>
		<pubDate>Sat, 23 Dec 2006 12:27:58 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/10/29/automatic-image-captions-with-unobtrusive-javascript/#comment-2888</guid>
		<description>&lt;p&gt;Ack -- I somehow referenced the same JS file (I was sure I referenced the new one).  Anyhow that mistake is fixed now.&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Ack &#8212; I somehow referenced the same JS file (I was sure I referenced the new one).  Anyhow that mistake is fixed now.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul Adler</title>
		<link>http://www.xaprb.com/blog/2006/10/29/automatic-image-captions-with-unobtrusive-javascript/#comment-2886</link>
		<author>Paul Adler</author>
		<pubDate>Sat, 23 Dec 2006 06:30:32 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/10/29/automatic-image-captions-with-unobtrusive-javascript/#comment-2886</guid>
		<description>&lt;p&gt;Yes, It does look different in IE and it's definately not pixel identical.  It must be how the browser is handling the whitespace.  I downloaded the javascript file referenced in your new demo page, and I can't see where you have concatenated a space to your title.  I did it this way: var txt = document.createTextNode(' '+img.getAttribute('title'));&lt;/p&gt;

&lt;p&gt;Also for the benefit of other people looking at this site, I used the code from Framboos to handle putting captions under thumbnail images.  I found that this caused a formatting problem displaying images that were not part of a link.  There was extra space between the title and the caption, probably from the extra whitespace that some browsers add in when you add an element.  This was avoided by checking if(parent.tagName == 'A') and running Framboos code else running just the IMG code that's listed here.&lt;/p&gt;

&lt;pre&gt;	if(parent.tagName == 'A'){
			grandparent.insertBefore(frame, parent);
			parent.removeChild(img);
			grandparent.removeChild(parent);
			frame.appendChild(parent);
			parent.appendChild(img);
			frame.appendChild(txt);
	}
	else{
	      parent.insertBefore(frame, img);
	      parent.removeChild(img);
	      frame.appendChild(img);
	      frame.appendChild(txt);
	} &lt;/pre&gt;

&lt;p&gt;Hope this helps someone.&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Yes, It does look different in IE and it&#8217;s definately not pixel identical.  It must be how the browser is handling the whitespace.  I downloaded the javascript file referenced in your new demo page, and I can&#8217;t see where you have concatenated a space to your title.  I did it this way: var txt = document.createTextNode(&#8217; &#8216;+img.getAttribute(&#8217;title&#8217;));</p>
<p>Also for the benefit of other people looking at this site, I used the code from Framboos to handle putting captions under thumbnail images.  I found that this caused a formatting problem displaying images that were not part of a link.  There was extra space between the title and the caption, probably from the extra whitespace that some browsers add in when you add an element.  This was avoided by checking if(parent.tagName == &#8216;A&#8217;) and running Framboos code else running just the IMG code that&#8217;s listed here.</p>
<pre>	if(parent.tagName == 'A'){
			grandparent.insertBefore(frame, parent);
			parent.removeChild(img);
			grandparent.removeChild(parent);
			frame.appendChild(parent);
			parent.appendChild(img);
			frame.appendChild(txt);
	}
	else{
	      parent.insertBefore(frame, img);
	      parent.removeChild(img);
	      frame.appendChild(img);
	      frame.appendChild(txt);
	} </pre>
<p>Hope this helps someone.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Xaprb</title>
		<link>http://www.xaprb.com/blog/2006/10/29/automatic-image-captions-with-unobtrusive-javascript/#comment-2880</link>
		<author>Xaprb</author>
		<pubDate>Fri, 22 Dec 2006 12:52:57 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/10/29/automatic-image-captions-with-unobtrusive-javascript/#comment-2880</guid>
		<description>&lt;p&gt;I put up &lt;a href="/articles/automatic-image-captions-space.html"&gt;another demo page&lt;/a&gt;, and in Firefox 2 on Ubuntu the pages look pixel-identical to me (&lt;a href="/articles/automatic-image-captions-screenshot.png"&gt;screenshot&lt;/a&gt;).  Does it look different in IE?&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>I put up <a href="/articles/automatic-image-captions-space.html">another demo page</a>, and in Firefox 2 on Ubuntu the pages look pixel-identical to me (<a href="/articles/automatic-image-captions-screenshot.png">screenshot</a>).  Does it look different in IE?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul Adler</title>
		<link>http://www.xaprb.com/blog/2006/10/29/automatic-image-captions-with-unobtrusive-javascript/#comment-2878</link>
		<author>Paul Adler</author>
		<pubDate>Fri, 22 Dec 2006 01:05:08 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/10/29/automatic-image-captions-with-unobtrusive-javascript/#comment-2878</guid>
		<description>&lt;p&gt;Can you try putting a space before your title on your demo page?  I'd be interested to see if this fixes the problem that I see on your page with both ie 6 and 7, where the padding between the image and the border is not uniform.  There are more pixels on the right hand side than on the left.  I'd also be interested to see what this does in the browser you are using.&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Can you try putting a space before your title on your demo page?  I&#8217;d be interested to see if this fixes the problem that I see on your page with both ie 6 and 7, where the padding between the image and the border is not uniform.  There are more pixels on the right hand side than on the left.  I&#8217;d also be interested to see what this does in the browser you are using.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Xaprb</title>
		<link>http://www.xaprb.com/blog/2006/10/29/automatic-image-captions-with-unobtrusive-javascript/#comment-2877</link>
		<author>Xaprb</author>
		<pubDate>Fri, 22 Dec 2006 00:43:28 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/10/29/automatic-image-captions-with-unobtrusive-javascript/#comment-2877</guid>
		<description>&lt;p&gt;Paul, I don't have IE handy, but I'd guess that the space is allowing the text to wrap under the image by creating a "word break."  That's a simple solution to the problem.  Simple is good!&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Paul, I don&#8217;t have IE handy, but I&#8217;d guess that the space is allowing the text to wrap under the image by creating a &#8220;word break.&#8221;  That&#8217;s a simple solution to the problem.  Simple is good!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul Adler</title>
		<link>http://www.xaprb.com/blog/2006/10/29/automatic-image-captions-with-unobtrusive-javascript/#comment-2875</link>
		<author>Paul Adler</author>
		<pubDate>Thu, 21 Dec 2006 23:14:27 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/10/29/automatic-image-captions-with-unobtrusive-javascript/#comment-2875</guid>
		<description>&lt;p&gt;Thanks for this post.  I thought I would let you know about a couple of problems that I had with this code on a new site I am building and how I solved them.  I am using this technique with a CMS that uses jquery (Drupal V5.0) and not the prototype library.  I changed this line to get it to work with the DOM traversal in Jquery:&lt;/p&gt;

&lt;pre&gt;var images = document.getElementsByClassName(className); 
//to
var images = $('img.figure');&lt;/pre&gt;

&lt;p&gt;I am using IE6 SP2 and I had a problem with some additional whitespace on the right hand side of the images.  It was like I had more padding on the right hand side.&lt;/p&gt;

&lt;p&gt;On IE7 this space wasn't as noticeable, however if you had a long title the first word would sometimes appear on the right hand side of the image instead of underneath it.  On your demonstation page in ie6 I see more whitespace on the right hand side of your images.  When I look at your demo page with IE7, there is no padding at all on the right hand side of the lower image.  I found that these problems were fixed by concatenating a space to the start of the title.  This space doesn't show up in the caption under the image.  I did this with the following line:&lt;/p&gt;

&lt;pre&gt;var txt = document.createTextNode(' '+img.getAttribute('title'));&lt;/pre&gt;

&lt;p&gt;I'd appreciate your comments on all this.&lt;/p&gt;

&lt;p&gt;Regards,
Paul.&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Thanks for this post.  I thought I would let you know about a couple of problems that I had with this code on a new site I am building and how I solved them.  I am using this technique with a CMS that uses jquery (Drupal V5.0) and not the prototype library.  I changed this line to get it to work with the DOM traversal in Jquery:</p>
<pre>var images = document.getElementsByClassName(className);
//to
var images = $('img.figure');</pre>
<p>I am using IE6 SP2 and I had a problem with some additional whitespace on the right hand side of the images.  It was like I had more padding on the right hand side.</p>
<p>On IE7 this space wasn&#8217;t as noticeable, however if you had a long title the first word would sometimes appear on the right hand side of the image instead of underneath it.  On your demonstation page in ie6 I see more whitespace on the right hand side of your images.  When I look at your demo page with IE7, there is no padding at all on the right hand side of the lower image.  I found that these problems were fixed by concatenating a space to the start of the title.  This space doesn&#8217;t show up in the caption under the image.  I did this with the following line:</p>
<pre>var txt = document.createTextNode(' '+img.getAttribute('title'));</pre>
<p>I&#8217;d appreciate your comments on all this.</p>
<p>Regards,<br />
Paul.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
