<?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>thetransient &#187; jQuery</title>
	<atom:link href="http://www.thetransient.com/tag/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thetransient.com</link>
	<description>One designer's web design blog</description>
	<lastBuildDate>Wed, 12 May 2010 17:21:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Unclutter your website with simple jQuery javascript show and hide</title>
		<link>http://www.thetransient.com/unclutter-your-website-with-simple-jquery-javascript-show-and-hide/110/</link>
		<comments>http://www.thetransient.com/unclutter-your-website-with-simple-jquery-javascript-show-and-hide/110/#comments</comments>
		<pubDate>Sat, 06 Sep 2008 05:39:49 +0000</pubDate>
		<dc:creator>Erik Phipps</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[UI]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[user interface design]]></category>

		<guid isPermaLink="false">http://www.thetransient.com/?p=110</guid>
		<description><![CDATA[Here&#8217;s a tip to reduce clutter on a page with lots of repeating links, icons and/or elements. Say you have a list of search results on your website and each result has many action icons and links. It isn&#8217;t necessary to have to links and icons visible at all times. The non-vital content can be [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a tip to reduce clutter on a page with lots of repeating links, icons and/or elements. Say you have a list of search results on your website and each result has many action icons and links. It isn&#8217;t necessary to have to links and icons visible at all times. The non-vital content can be hidden by default and only shown when the user hovers over the search result containing element.</p>
<p>Check out this <a href="/wp-content/examples/jQuery/post_110_unclutterExample.htm">hiding non-vital content example</a>.</p>
<p>The method for the example is very simple and can be accomplished with a small jQuery function and a single class assigned to each element we want to hide. This can of course be done with plain old javascript as well but I&#8217;ll use jQuery because it&#8217;s so darn easy.</p>
<p>Here is the jQuery code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #006600; font-style: italic;">//hide secondary content</span>
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.secondaryContent&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;visibility&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;hidden&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// toggle secondary content items on hover</span>
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#p110_showHideExample li&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">hover</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.secondaryContent&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;visibility&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;visible&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.secondaryContent&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;visibility&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;hidden&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Now all we need to do is add the class &#8220;secondaryContent&#8221; to any element we want to be visible only when the user mouses over the containing element.</p>
<p>For example, here is the remove link html from the upper right corner of the example:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;delete secondaryContent&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>X<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.thetransient.com/unclutter-your-website-with-simple-jquery-javascript-show-and-hide/110/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
