<?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: Make a div clickable</title> <atom:link href="http://friendlybit.com/js/make-a-div-clickable/feed/" rel="self" type="application/rss+xml" /><link>http://friendlybit.com/js/make-a-div-clickable/</link> <description>You have found Friendly Bit, a web development blog. I focus on client side technologies like CSS, HTML and Javascript. You find my articles below and categories to the right.</description> <lastBuildDate>Fri, 12 Mar 2010 22:50:44 +0000</lastBuildDate> <generator>http://wordpress.org/?v=2.9.2</generator> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <item><title>By: Kristopher</title><link>http://friendlybit.com/js/make-a-div-clickable/#comment-33356</link> <dc:creator>Kristopher</dc:creator> <pubDate>Tue, 19 Jan 2010 13:16:32 +0000</pubDate> <guid
isPermaLink="false">http://friendlybit.com/?p=498#comment-33356</guid> <description>Nice! I love the fallback method and using the first link, instead of just hard coding some URL on the div. Very cool!</description> <content:encoded><![CDATA[<p>Nice! I love the fallback method and using the first link, instead of just hard coding some URL on the div. Very cool!</p> ]]></content:encoded> </item> <item><title>By: Lewis Litanzios</title><link>http://friendlybit.com/js/make-a-div-clickable/#comment-33131</link> <dc:creator>Lewis Litanzios</dc:creator> <pubDate>Fri, 16 Oct 2009 22:38:04 +0000</pubDate> <guid
isPermaLink="false">http://friendlybit.com/?p=498#comment-33131</guid> <description>Yea, the &quot;1&#039;s&quot; in pagination are a culprit here - pet usability hate of mine!I used this typa technique recently on a &#039;Read more...&#039; link: http://is.gd/4n09N (pulling in the post title URL and then hiding the title).</description> <content:encoded><![CDATA[<p>Yea, the &#8220;1&#8217;s&#8221; in pagination are a culprit here &#8211; pet usability hate of mine!</p><p>I used this typa technique recently on a &#8216;Read more&#8230;&#8217; link: <a
href="http://is.gd/4n09N">http://is.gd/4n09N</a> (pulling in the post title URL and then hiding the title).</p> ]]></content:encoded> </item> <item><title>By: Hacer un div clicable &#124; Artimedia Blog</title><link>http://friendlybit.com/js/make-a-div-clickable/#comment-32987</link> <dc:creator>Hacer un div clicable &#124; Artimedia Blog</dc:creator> <pubDate>Thu, 10 Sep 2009 15:23:21 +0000</pubDate> <guid
isPermaLink="false">http://friendlybit.com/?p=498#comment-32987</guid> <description>[...] veces interesa hacer una zona clicable en vez de un enlace de texto pequeño. En este artículo de friendlybit.com se presenta el código para hacer un div clicable que además puede contener otros enlaces [...]</description> <content:encoded><![CDATA[<p>[...] veces interesa hacer una zona clicable en vez de un enlace de texto pequeño. En este artículo de friendlybit.com se presenta el código para hacer un div clicable que además puede contener otros enlaces [...]</p> ]]></content:encoded> </item> <item><title>By: Alex</title><link>http://friendlybit.com/js/make-a-div-clickable/#comment-32927</link> <dc:creator>Alex</dc:creator> <pubDate>Tue, 25 Aug 2009 02:04:16 +0000</pubDate> <guid
isPermaLink="false">http://friendlybit.com/?p=498#comment-32927</guid> <description>@Emil, sorry i noticed that the real link retains it&#039;s capabilities only after i&#039;ve posted my last comment.What i really like is that even if javascript is disabled you don&#039;t get any error messages and the div block remains as if there is no javascript there.</description> <content:encoded><![CDATA[<p>@Emil, sorry i noticed that the real link retains it&#8217;s capabilities only after i&#8217;ve posted my last comment.</p><p>What i really like is that even if javascript is disabled you don&#8217;t get any error messages and the div block remains as if there is no javascript there.</p> ]]></content:encoded> </item> <item><title>By: Emil Stenström</title><link>http://friendlybit.com/js/make-a-div-clickable/#comment-32926</link> <dc:creator>Emil Stenström</dc:creator> <pubDate>Mon, 24 Aug 2009 19:51:53 +0000</pubDate> <guid
isPermaLink="false">http://friendlybit.com/?p=498#comment-32926</guid> <description>@Alex: Unfortunately, there&#039;s no easy way to do that to the whole block. Though you could right-click on the real link, and do what you want there.</description> <content:encoded><![CDATA[<p>@Alex: Unfortunately, there&#8217;s no easy way to do that to the whole block. Though you could right-click on the real link, and do what you want there.</p> ]]></content:encoded> </item> <item><title>By: Alex</title><link>http://friendlybit.com/js/make-a-div-clickable/#comment-32925</link> <dc:creator>Alex</dc:creator> <pubDate>Sun, 23 Aug 2009 16:03:26 +0000</pubDate> <guid
isPermaLink="false">http://friendlybit.com/?p=498#comment-32925</guid> <description>@Emil, if that&#039;s cleared, how can we make the link to open in a new tab/windows on right click?</description> <content:encoded><![CDATA[<p>@Emil, if that&#8217;s cleared, how can we make the link to open in a new tab/windows on right click?</p> ]]></content:encoded> </item> <item><title>By: Emil Stenström</title><link>http://friendlybit.com/js/make-a-div-clickable/#comment-32922</link> <dc:creator>Emil Stenström</dc:creator> <pubDate>Sat, 22 Aug 2009 17:27:07 +0000</pubDate> <guid
isPermaLink="false">http://friendlybit.com/?p=498#comment-32922</guid> <description>@Alex: This way of doing this is unobtrusive, which means that even if Google wouldn&#039;t read the data, it could still find and parse the link.</description> <content:encoded><![CDATA[<p>@Alex: This way of doing this is unobtrusive, which means that even if Google wouldn&#8217;t read the data, it could still find and parse the link.</p> ]]></content:encoded> </item> <item><title>By: Alex</title><link>http://friendlybit.com/js/make-a-div-clickable/#comment-32920</link> <dc:creator>Alex</dc:creator> <pubDate>Fri, 21 Aug 2009 18:13:02 +0000</pubDate> <guid
isPermaLink="false">http://friendlybit.com/?p=498#comment-32920</guid> <description>Do you think that by using this javascript method the SEO of that page will remain the same? Google has some issues reading javascript..Anyway the demo looks great!</description> <content:encoded><![CDATA[<p>Do you think that by using this javascript method the SEO of that page will remain the same? Google has some issues reading javascript..</p><p>Anyway the demo looks great!</p> ]]></content:encoded> </item> <item><title>By: Emil Stenström</title><link>http://friendlybit.com/js/make-a-div-clickable/#comment-32868</link> <dc:creator>Emil Stenström</dc:creator> <pubDate>Fri, 24 Jul 2009 11:11:55 +0000</pubDate> <guid
isPermaLink="false">http://friendlybit.com/?p=498#comment-32868</guid> <description>@Andreas: It&#039;s actually not exactly the same, as it has some strange side effects. Since the image covers all the text and images in the teaser, you can select or save the text or the image. And you can&#039;t have more than one link in the same teaser, something that might matter for some (although few) people. On the other hand you get the possibility to middle-click the link, and all that.Nah, I still like the HTML5 solution (see above comment) best I think.</description> <content:encoded><![CDATA[<p>@Andreas: It&#8217;s actually not exactly the same, as it has some strange side effects. Since the image covers all the text and images in the teaser, you can select or save the text or the image. And you can&#8217;t have more than one link in the same teaser, something that might matter for some (although few) people. On the other hand you get the possibility to middle-click the link, and all that.</p><p>Nah, I still like the HTML5 solution (see above comment) best I think.</p> ]]></content:encoded> </item> <item><title>By: Andreas</title><link>http://friendlybit.com/js/make-a-div-clickable/#comment-32867</link> <dc:creator>Andreas</dc:creator> <pubDate>Fri, 24 Jul 2009 10:58:43 +0000</pubDate> <guid
isPermaLink="false">http://friendlybit.com/?p=498#comment-32867</guid> <description>Simply positioning an a-element absolutely on top of the div with a width and height of 100% would achieve the same thing, no? _And_ it would act exactly the same as a real link (as it _is_ a real link).I&#039;ve done it this way before though as well, just a thought.Regarding the JS-only CSS; I&#039;ve used a js-enabled/js-disabled class on the body-element for ages now and it&#039;s perfect for things like this.I add the js-enabled class immediately after the opening body-tag so there&#039;ll be no lag for the JS-only styling:&lt;code&gt;
&lt;body class=&quot;js-disabled&quot;&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
document.body.className = &#039;js-enabled&#039;;
&lt;/script&gt;
&lt;/code&gt;As any performance-aware front-end developer I include all my JS before the _closing_ body-tag so it normally takes a couple of seconds before it kicks in. Giving body the js-enabled class at the top avoids styles blinking in though.</description> <content:encoded><![CDATA[<p>Simply positioning an a-element absolutely on top of the div with a width and height of 100% would achieve the same thing, no? _And_ it would act exactly the same as a real link (as it _is_ a real link).</p><p>I&#8217;ve done it this way before though as well, just a thought.</p><p>Regarding the JS-only CSS; I&#8217;ve used a js-enabled/js-disabled class on the body-element for ages now and it&#8217;s perfect for things like this.</p><p>I add the js-enabled class immediately after the opening body-tag so there&#8217;ll be no lag for the JS-only styling:</p><p><code><br
/> &lt;body class="js-disabled"&gt;<br
/> &lt;script type="text/javascript"&gt;<br
/> document.body.className = 'js-enabled';<br
/> &lt;/script&gt;<br
/> </code></p><p>As any performance-aware front-end developer I include all my JS before the _closing_ body-tag so it normally takes a couple of seconds before it kicks in. Giving body the js-enabled class at the top avoids styles blinking in though.</p> ]]></content:encoded> </item> <item><title>By: Emil Stenström</title><link>http://friendlybit.com/js/make-a-div-clickable/#comment-32858</link> <dc:creator>Emil Stenström</dc:creator> <pubDate>Thu, 23 Jul 2009 18:47:32 +0000</pubDate> <guid
isPermaLink="false">http://friendlybit.com/?p=498#comment-32858</guid> <description>@Stevie D: Nice to see that my scribbling is of use to someone :)</description> <content:encoded><![CDATA[<p>@Stevie D: Nice to see that my scribbling is of use to someone :)</p> ]]></content:encoded> </item> <item><title>By: Stevie D</title><link>http://friendlybit.com/js/make-a-div-clickable/#comment-32857</link> <dc:creator>Stevie D</dc:creator> <pubDate>Thu, 23 Jul 2009 12:07:01 +0000</pubDate> <guid
isPermaLink="false">http://friendlybit.com/?p=498#comment-32857</guid> <description>Brilliant! I have been doing this manually on my website for a few years, just adding an &lt;code&gt;onClick&lt;/code&gt; event to the containing &lt;code&gt;div&lt;/code&gt; - see website link for example. But this looks like a better solution, means I don&#039;t need to worry about putting in the links twice every time.&lt;blockquote&gt;Why not just give links more padding? Making elements clickable that are normally not clickable leads to confusion and is not a behavior users expect.&lt;/blockquote&gt;
It depends on the nature of the content. In some cases, extra padding, leading or spacing will do a good job. In other cases, it helps to make surrounding content clickable. For example, on my website, there is a &#039;panel&#039; that contains several items, and making the entire panel into a link makes it easier for users to select it - while, of course, retaining on old fasioned anchor on the first line for accessibility and spiders.By applying &lt;code&gt;:hover&lt;/code&gt; properties to the &lt;code&gt;div&lt;/code&gt;, you give the visual affordance of a link to users (hand cursor, change of colour), so there should be no problem with unexpected behaviour.</description> <content:encoded><![CDATA[<p>Brilliant! I have been doing this manually on my website for a few years, just adding an <code>onClick</code> event to the containing <code>div</code> &#8211; see website link for example. But this looks like a better solution, means I don&#8217;t need to worry about putting in the links twice every time.</p><blockquote><p>Why not just give links more padding? Making elements clickable that are normally not clickable leads to confusion and is not a behavior users expect.</p></blockquote><p>It depends on the nature of the content. In some cases, extra padding, leading or spacing will do a good job. In other cases, it helps to make surrounding content clickable. For example, on my website, there is a &#8216;panel&#8217; that contains several items, and making the entire panel into a link makes it easier for users to select it &#8211; while, of course, retaining on old fasioned anchor on the first line for accessibility and spiders.</p><p>By applying <code>:hover</code> properties to the <code>div</code>, you give the visual affordance of a link to users (hand cursor, change of colour), so there should be no problem with unexpected behaviour.</p> ]]></content:encoded> </item> <item><title>By: Anders Ytterström</title><link>http://friendlybit.com/js/make-a-div-clickable/#comment-32846</link> <dc:creator>Anders Ytterström</dc:creator> <pubDate>Wed, 15 Jul 2009 19:33:22 +0000</pubDate> <guid
isPermaLink="false">http://friendlybit.com/?p=498#comment-32846</guid> <description>In really extreme cases (that is, 80+ teasers) further enhancements can be done by letting a global click listener do the job with event delegation.That will save a few buck on DOMready, especially in IE which is really slow in comparison.</description> <content:encoded><![CDATA[<p>In really extreme cases (that is, 80+ teasers) further enhancements can be done by letting a global click listener do the job with event delegation.</p><p>That will save a few buck on DOMready, especially in IE which is really slow in comparison.</p> ]]></content:encoded> </item> <item><title>By: Emil Stenström</title><link>http://friendlybit.com/js/make-a-div-clickable/#comment-32843</link> <dc:creator>Emil Stenström</dc:creator> <pubDate>Wed, 15 Jul 2009 06:39:06 +0000</pubDate> <guid
isPermaLink="false">http://friendlybit.com/?p=498#comment-32843</guid> <description>@Krijn Hoetmer: Great comments, you know a lot about stuff :) A search engine experiment with block links would be interesting. My guess is that the more words you have inside your link, the less weight each of them have. So for SEO, this might not be the most optimal solution. On the other hand, search engines care about words around a link too, so I&#039;m not sure how much of a difference it makes.</description> <content:encoded><![CDATA[<p>@Krijn Hoetmer: Great comments, you know a lot about stuff :) A search engine experiment with block links would be interesting. My guess is that the more words you have inside your link, the less weight each of them have. So for SEO, this might not be the most optimal solution. On the other hand, search engines care about words around a link too, so I&#8217;m not sure how much of a difference it makes.</p> ]]></content:encoded> </item> <item><title>By: Krijn Hoetmer</title><link>http://friendlybit.com/js/make-a-div-clickable/#comment-32835</link> <dc:creator>Krijn Hoetmer</dc:creator> <pubDate>Mon, 13 Jul 2009 09:12:23 +0000</pubDate> <guid
isPermaLink="false">http://friendlybit.com/?p=498#comment-32835</guid> <description>Also, using this, you get &lt;code&gt;:hover&lt;/code&gt; styles for free (without using JS hacks) in IE6, since that babe only understands &lt;code&gt;:hover&lt;/code&gt; on &lt;code&gt;a[href]&lt;/code&gt;.I only wonder how search engines and AT work with this. &quot;Click here&quot; links clearly suck, but perhaps linking entire blocks of text, including headings, sucks as well. Would using &lt;code&gt;title=&quot;&quot;&lt;/code&gt; on the link solve that? Somebody should do some study in that field :)</description> <content:encoded><![CDATA[<p>Also, using this, you get <code>:hover</code> styles for free (without using JS hacks) in IE6, since that babe only understands <code>:hover</code> on <code>a[href]</code>.</p><p>I only wonder how search engines and AT work with this. &#8220;Click here&#8221; links clearly suck, but perhaps linking entire blocks of text, including headings, sucks as well. Would using <code>title=""</code> on the link solve that? Somebody should do some study in that field :)</p> ]]></content:encoded> </item> </channel> </rss>
<!-- This site's performance optimized by W3 Total Cache. Dramatically improve the speed and reliability of your blog!

Learn more about our WordPress Plugins: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (user agent is rejected)
Database Caching 20/36 queries in 0.016 seconds using disk

Served from: c8.67.364a.static.theplanet.com @ 2010-03-14 23:41:54 -->