<?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>Blog de Livi &#187; jQuery</title>
	<atom:link href="http://blog.delivi.com/topics/jquery/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.delivi.com</link>
	<description></description>
	<lastBuildDate>Tue, 29 Jun 2010 15:52:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1-alpha-15359</generator>
		<item>
		<title>Hover for non-anchor elements in IE6</title>
		<link>http://blog.delivi.com/javascript/hover-for-non-anchor-elements-in-ie6</link>
		<comments>http://blog.delivi.com/javascript/hover-for-non-anchor-elements-in-ie6#comments</comments>
		<pubDate>Wed, 20 Feb 2008 11:15:00 +0000</pubDate>
		<dc:creator>livingston</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[IE6 Hover]]></category>

		<guid isPermaLink="false">http://blog.delivi.info/javascript/hover-for-non-anchor-elements-in-ie6/</guid>
		<description><![CDATA[Updated article on Hover for non-anchor elements in IE6 The :hover pseudo-class adds a special style to an element when you mouse over it. The &#8216;:hover&#8217; pseudo-class works fine in IE7, FF, Safari and Opera for all the elements. But &#8230; <a href="http://blog.delivi.com/javascript/hover-for-non-anchor-elements-in-ie6">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><strong>Updated article on <a href="http://blog.delivi.com/javascript/updated-hover-for-non-anchor-elements-in-ie6/">Hover for non-anchor elements in IE6</a></strong></p>
<p>The :hover pseudo-class adds a special style to an element when you mouse over it.</p>
<p>The &#8216;:hover&#8217; pseudo-class works fine in <abbr title="Internet Explorer 7">IE7</abbr>, <abbr title="Firefox">FF</abbr>, Safari and Opera for all the elements. But for obvious reasons <abbr title="Internet Explorer 6">IE6</abbr> fails to recognize the &#8216;:hover&#8217; pseudo-class for all elements other than the anchor(&lt;a&gt;&lt;/a&gt;).</p>
<p>The &#8216;:hover&#8217; pseudo-class can be made to work in IE6 with the help of  the jQuery method &#8216;hover()&#8217;.</p>
<p>Lets see how it is done.</p>
<p><span id="more-14"></span></p>
<p>For each element that you want the &#8216;hover&#8217; to be enabled add a class &#8220;hoverable&#8221; to it.</p>
<pre class='brush:html'>
<div id="theBox" class="hoverable">
<h2>Hover Over Me!</h2>
</div>
</pre>
<p>In the CSS file define the style for the hovered state with a class &#8220;.hovered&#8221;.</p>
<pre class='brush:css'>   #theBox {
       width:200px;
       height:200px;
       background:#F1E592;
       margin:50px auto;
       border:5px solid #540505;
    }
   #theBox.hovered, #theBox:hover {
       width:200px;
       height:200px;
       background:#540505;
       border:margin:50px auto;
       border:5px solid #F1E592;
    }</pre>
<p>Now the jQuery part,  download the latest release of jQuery.js file from <a href="http://docs.jquery.com/Downloading_jQuery">http://docs.jquery.com/Downloading_jQuery</a> and include it in the head of the page as shown below,</p>
<pre  class='brush:html'>&lt;script src="jquery.js" type="text/javascript"&gt;&lt;/script&gt;</pre>
<p>Use the following code in between the &#8216;&lt;head&gt;&lt;/head&gt;&#8217; tags in your page to get the hover function in IE6.</p>
<pre class='brush:javascript'> &lt;script type="text/javascript"&gt;
$(document).ready(function() {
       $('.hoverable').hover(
          function() {
             $(this).addClass('hovered');     /* On hover add the class 'hovered' and apply the hovered styles */
          }, function() {
             $(this).removeClass('hovered');  /* On mouseout remove the class 'hovered' and reset the styles   */
          }
       );
    });
&lt;/script&gt;</pre>
<p>This will work in all browsers. I&#8217;ve also added the &#8216;:hover&#8217; pseudo-class to the CSS style so that the modern browsers can display the hover style even when JavaScript is disabled.</p>
<p>View the code in action at <a href="http://blog.delivi.com/examples/ie6-hover/index.html">http://blog.delivi.com/examples/ie6-hover/</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.delivi.com/javascript/hover-for-non-anchor-elements-in-ie6/feed</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
	</channel>
</rss>
