<?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>Lab of Chowky &#187; menu</title>
	<atom:link href="http://lab.chowky.com/tag/menu/feed/" rel="self" type="application/rss+xml" />
	<link>http://lab.chowky.com</link>
	<description>分享ＩＴ技術</description>
	<lastBuildDate>Sun, 01 Jan 2012 06:13:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>CSS navigation with 3 個不同的state (default, active, hover)</title>
		<link>http://lab.chowky.com/2009/09/css-navigation-with-3-%e5%80%8b%e4%b8%8d%e5%90%8c%e7%9a%84state-default-active-hover/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=css-navigation-with-3-%25e5%2580%258b%25e4%25b8%258d%25e5%2590%258c%25e7%259a%2584state-default-active-hover</link>
		<comments>http://lab.chowky.com/2009/09/css-navigation-with-3-%e5%80%8b%e4%b8%8d%e5%90%8c%e7%9a%84state-default-active-hover/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 18:08:01 +0000</pubDate>
		<dc:creator>Chowky</dc:creator>
				<category><![CDATA[Jquery, Mootools]]></category>
		<category><![CDATA[3 states]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[horizontal]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[menu]]></category>
		<category><![CDATA[navigation]]></category>

		<guid isPermaLink="false">http://lab.chowky.com/?p=1324</guid>
		<description><![CDATA[這個navigation 令chowky 眼前一亮，真的很難明白為什麼一個developer 會有這麼高的design sense 呢~ 令人羨慕。 見到效果是否覺得不錯呢~。 最難得是簡單直接~~(當然這個東西不太適用於cms 的template design 上，他的做法不是dynamic 的~但得到的是design 上的空間) HTML 方面都是利用ul (unordered list) &#60;ul id=&#34;topnav&#34;&#62; &#60;li class=&#34;home&#34;&#62;&#60;a href=&#34;index.htm&#34;&#62;Home&#60;/a&#62;&#60;/li&#62; &#60;li class=&#34;about&#34;&#62;&#60;a href=&#34;about.htm&#34;&#62;About Us&#60;/a&#62;&#60;/li&#62; &#60;li class=&#34;services&#34;&#62;&#60;a href=&#34;services.htm&#34;&#62;Services&#60;/a&#62;&#60;/li&#62; &#60;li class=&#34;portfolio&#34;&#62;&#60;a href=&#34;portfolio.htm&#34;&#62;Portfolio&#60;/a&#62;&#60;/li&#62; &#60;li class=&#34;contact&#34;&#62;&#60;a href=&#34;contact.htm&#34;&#62;Contact&#60;/a&#62;&#60;/li&#62; &#60;li class=&#34;blog&#34;&#62;&#60;a href=&#34;blog.htm&#34;&#62;Blog&#60;/a&#62;&#60;/li&#62; &#60;/ul&#62; CSS styling 方面，基本的樣貌已經完成。 1 2 3 4 5 6 7 8 9 10 ul#topnav &#123; [...]]]></description>
			<content:encoded><![CDATA[<p>這個navigation 令chowky 眼前一亮，真的很難明白為什麼一個developer 會有這麼高的design sense 呢~ 令人羨慕。</p>
<p><img src="http://www.sohtanaka.com/web-design/examples/active-navigation/demo.gif" alt="" /></p>
<p>見到效果是否覺得不錯呢~。</p>
<p>最難得是簡單直接~~(當然這個東西不太適用於cms 的template design 上，他的做法不是dynamic 的~但得到的是design 上的空間)</p>
<p>HTML 方面都是利用ul (unordered list)</p>

<div class="wp_syntax"><div class="code"><pre class="_1" style="font-family:monospace;">&lt;ul id=&quot;topnav&quot;&gt;
	&lt;li class=&quot;home&quot;&gt;&lt;a href=&quot;index.htm&quot;&gt;Home&lt;/a&gt;&lt;/li&gt;
	&lt;li class=&quot;about&quot;&gt;&lt;a href=&quot;about.htm&quot;&gt;About Us&lt;/a&gt;&lt;/li&gt;
	&lt;li class=&quot;services&quot;&gt;&lt;a href=&quot;services.htm&quot;&gt;Services&lt;/a&gt;&lt;/li&gt;
	&lt;li class=&quot;portfolio&quot;&gt;&lt;a href=&quot;portfolio.htm&quot;&gt;Portfolio&lt;/a&gt;&lt;/li&gt;
	&lt;li class=&quot;contact&quot;&gt;&lt;a href=&quot;contact.htm&quot;&gt;Contact&lt;/a&gt;&lt;/li&gt;
	&lt;li class=&quot;blog&quot;&gt;&lt;a href=&quot;blog.htm&quot;&gt;Blog&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</pre></div></div>

<p><span id="more-1324"></span><br />
CSS styling 方面，基本的樣貌已經完成。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="css" style="font-family:monospace;">ul<span style="color: #cc00cc;">#topnav</span> <span style="color: #00AA00;">&#123;</span> 
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">list-style</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">960px</span><span style="color: #00AA00;">;</span> //這是整個menu 的闊 <span style="color: #cc66cc;">960</span> x <span style="color: #cc66cc;">800</span> 是web design 上的magic number
<span style="color: #00AA00;">&#125;</span>
ul<span style="color: #cc00cc;">#topnav</span> li <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p>現在要加上3 個的state，利用了<a href="http://www.smashingmagazine.com/2009/04/27/the-mystery-of-css-sprites-techniques-tools-and-tutorials/">css sprite</a> (chowky 看完才知道原來利用background position 這種technique 是有名堂的呢~)<br />
<img src="http://www.sohtanaka.com/web-design/examples/active-navigation/demo_view.gif" alt="" /></p>
<p>加完下面的CSS 之後，就會完成了2個state： default 和 hover</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/*--CSS Sprites - Default State--*/</span>
ul<span style="color: #cc00cc;">#topnav</span> a <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">58px</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/*--Specify height of navigation--*/</span>
	<span style="color: #000000; font-weight: bold;">text-indent</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-99999px</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/*--Shoot the text off the page--*/</span>
	<span style="color: #000000; font-weight: bold;">background-position</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #808080; font-style: italic;">/*--CSS Sprites - Hover State--*/</span>
ul<span style="color: #cc00cc;">#topnav</span> a<span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background-position</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #933;">-58px</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/*--- coordination system 是left top 代表座標上的(0,0) ，所以(-)是代表向下。*/</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #808080; font-style: italic;">/*--Assign an image and width to each link--*/</span>
ul<span style="color: #cc00cc;">#topnav</span> li<span style="color: #6666ff;">.home</span> a <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background-image</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">home_a.jpg</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">120px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
ul<span style="color: #cc00cc;">#topnav</span> li<span style="color: #6666ff;">.about</span> a <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background-image</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">about_a.jpg</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">147px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
ul<span style="color: #cc00cc;">#topnav</span> li<span style="color: #6666ff;">.services</span> a <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background-image</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">services_a.jpg</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">157px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
ul<span style="color: #cc00cc;">#topnav</span> li<span style="color: #6666ff;">.portfolio</span> a <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background-image</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">portfolio_a.jpg</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">182px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
ul<span style="color: #cc00cc;">#topnav</span> li<span style="color: #6666ff;">.contact</span> a <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background-image</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">contact_a.jpg</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">179px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
ul<span style="color: #cc00cc;">#topnav</span> li<span style="color: #6666ff;">.blog</span> a <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background-image</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">blog_a.jpg</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">175px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p>之後就要加上最後一個state: “Active&#8221;。<br />
作的的做法是在html 的tag 上加上 id  ，所以每一頁都要在body 的tag 上加上id 的attribute</p>
<p>註：其他不同的navigation 的example 會加多一個class attribute= &#8220;active&#8221; 再用CSS LOAD active 的圖</p>
<p>Home Page HTML</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">...
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">body</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;home&quot;</span>&gt;</span>
...</pre></div></div>

<p>之後就要利用 <a href="http://www.smashingmagazine.com/2007/07/27/css-specificity-things-you-should-know/">CSS Specificity</a> 去override default 和 hover states.</p>
<p>因為作者的方法是用不同的圖做的。所以每加一個menu item 就要加一個呢～</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#home</span> li<span style="color: #6666ff;">.home</span> a<span style="color: #00AA00;">,</span> <span style="color: #808080; font-style: italic;">/*--Home Page &gt; Home Link--*/</span>
<span style="color: #cc00cc;">#about</span> li<span style="color: #6666ff;">.about</span> a<span style="color: #00AA00;">,</span> <span style="color: #808080; font-style: italic;">/*--About Page &gt; About Link--*/</span>
<span style="color: #cc00cc;">#services</span> li<span style="color: #6666ff;">.services</span> a<span style="color: #00AA00;">,</span> <span style="color: #808080; font-style: italic;">/*--Services Page &gt; Services Link--*/</span>
<span style="color: #cc00cc;">#portfolio</span> li<span style="color: #6666ff;">.portfolio</span> a<span style="color: #00AA00;">,</span> <span style="color: #808080; font-style: italic;">/*--Portfolio Page &gt; Portfolio Link--*/</span>
<span style="color: #cc00cc;">#contact</span> li<span style="color: #6666ff;">.contact</span> a<span style="color: #00AA00;">,</span> <span style="color: #808080; font-style: italic;">/*--Contact Page &gt; Contact Link--*/</span>
<span style="color: #cc00cc;">#blog</span> li<span style="color: #6666ff;">.blog</span> a <span style="color: #808080; font-style: italic;">/*--Blog Page &gt; Blog Link--*/</span>
<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background-position</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #000000; font-weight: bold;">bottom</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>結構上如下：<br />
<img src="http://www.sohtanaka.com/web-design/examples/active-navigation/demo_active.gif" alt="" /></p>
<p>Demo: <a href="http://www.sohtanaka.com/web-design/examples/active-navigation/blog.htm">http://www.sohtanaka.com/web-design/examples/active-navigation/blog.htm</a><br />
Source: <a href="http://www.sohtanaka.com/web-design/active-state-in-css-navigations/">http://www.sohtanaka.com/web-design/active-state-in-css-navigations/</a></p>
 <img src="http://lab.chowky.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=1324" width="1" height="1" style="display: none;" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Flab.chowky.com%2F2009%2F09%2Fcss-navigation-with-3-%25e5%2580%258b%25e4%25b8%258d%25e5%2590%258c%25e7%259a%2584state-default-active-hover%2F&amp;title=CSS%20navigation%20with%203%20%E5%80%8B%E4%B8%8D%E5%90%8C%E7%9A%84state%20%28default%2C%20active%2C%20hover%29" id="wpa2a_2"><img src="http://lab.chowky.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://lab.chowky.com/2009/09/css-navigation-with-3-%e5%80%8b%e4%b8%8d%e5%90%8c%e7%9a%84state-default-active-hover/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[jQuery] 利用 jqeury 和 css 建立一個navigation menu</title>
		<link>http://lab.chowky.com/2009/08/jquery-animated-navigation-with-css-jquery/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jquery-animated-navigation-with-css-jquery</link>
		<comments>http://lab.chowky.com/2009/08/jquery-animated-navigation-with-css-jquery/#comments</comments>
		<pubDate>Mon, 03 Aug 2009 11:04:37 +0000</pubDate>
		<dc:creator>Chowky</dc:creator>
				<category><![CDATA[Jquery, Mootools]]></category>
		<category><![CDATA[Animated navigation]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[menu]]></category>

		<guid isPermaLink="false">http://lab.chowky.com/?p=1010</guid>
		<description><![CDATA[Chowky 一向欣賞這位作者所做的simple and elegent 效果和教學。 只是簡單的4個steps 就可以做到以下的效果。 Step 1: HTML 都是利用ul 和li 1 2 3 4 5 6 7 8 &#60;ul id=&#34;topnav&#34;&#62; &#60;li&#62;&#60;a href=&#34;#&#34;&#62;Home&#60;/a&#62;&#60;/li&#62; &#60;li&#62;&#60;a href=&#34;#&#34;&#62;Services&#60;/a&#62;&#60;/li&#62; &#60;li&#62;&#60;a href=&#34;#&#34;&#62;Portfolio&#60;/a&#62;&#60;/li&#62; &#60;li&#62;&#60;a href=&#34;#&#34;&#62;Blog&#60;/a&#62;&#60;/li&#62; &#60;li&#62;&#60;a href=&#34;#&#34;&#62;About&#60;/a&#62;&#60;/li&#62; &#60;li&#62;&#60;a href=&#34;#&#34;&#62;Contact&#60;/a&#62;&#60;/li&#62; &#60;/ul&#62; Step 2. CSS 要留意的是，現在是還未add span 的，span 會在之後用jquery 加上去。 1 2 3 4 5 6 7 8 9 10 11 12 [...]]]></description>
			<content:encoded><![CDATA[<p>Chowky 一向欣賞這位作者所做的simple and elegent 效果和教學。</p>
<p>只是簡單的4個steps 就可以做到以下的效果。<br />
<a href="http://www.sohtanaka.com/web-design/examples/fancy-navigation/final.gif"></a></p>
<p>Step 1: HTML 都是利用ul 和li</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;topnav&quot;</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</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>Home<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;">li</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</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>Services<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;">li</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</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>Portfolio<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;">li</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</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>Blog<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;">li</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</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>About<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;">li</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</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>Contact<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;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span></pre></td></tr></table></div>

<p>Step 2. CSS<br />
要留意的是，現在是還未add span 的，span 會在之後用jquery 加上去。<br />
<img src="http://www.sohtanaka.com/web-design/examples/fancy-navigation/preview_2.gif" alt="" /></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
</pre></td><td class="code"><pre class="css" style="font-family:monospace;">ul<span style="color: #cc00cc;">#topnav</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">list-style</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1.1em</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
ul<span style="color: #cc00cc;">#topnav</span> li<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span>  <span style="color: #808080; font-style: italic;">/*--Important - Masking out the hover state by default--*/</span>
	<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">40px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
ul<span style="color: #cc00cc;">#topnav</span> a<span style="color: #00AA00;">,</span> ul<span style="color: #cc00cc;">#topnav</span> span <span style="color: #00AA00;">&#123;</span> <span style="color: #808080; font-style: italic;">/*--The &lt;a&gt; and &lt;span&gt; share the same properties since the &lt;span&gt;  will be a duplicate of the &lt;a&gt; tag--*/</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">a_bg.gif</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">repeat-x</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">text-transform</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">uppercase</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">clear</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">both</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">line-height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/*--Vertical alignment of text--*/</span>
<span style="color: #00AA00;">&#125;</span>
ul<span style="color: #cc00cc;">#topnav</span> a<span style="color: #00AA00;">&#123;</span> <span style="color: #808080; font-style: italic;">/*--This is basically the hover state of navigation--*/</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#555</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background-position</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #000000; font-weight: bold;">bottom</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
ul<span style="color: #cc00cc;">#topnav</span> span<span style="color: #00AA00;">&#123;</span> <span style="color: #808080; font-style: italic;">/*--Default state of navigation--*/</span>
	<span style="color: #000000; font-weight: bold;">background-position</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p>Step 3. 利用jquery製造的animation effect</p>
<p>  a). embed jquery 的library</p>
<p>  b). 利用jqeury 去製造animation，shift image -40px pixel向上。 </p>
<p><img src="http://www.sohtanaka.com/web-design/examples/fancy-navigation/preview3.gif" alt="" /></p>

<div class="wp_syntax"><div class="code"><pre class="_1" style="font-family:monospace;">$(document).ready(function() {
&nbsp;
	$(&quot;#topnav li&quot;).prepend(&quot;&lt;span&gt;&lt;/span&gt;&quot;); //Throws an empty span tag right before the a tag
&nbsp;
	$(&quot;#topnav li&quot;).each(function() { //For each list item...
		var linkText = $(this).find(&quot;a&quot;).html(); //Find the text inside of the &lt;a&gt; tag
		$(this).find(&quot;span&quot;).show().html(linkText); //Add the text in the &lt;span&gt; tag
	}); 
&nbsp;
	$(&quot;#topnav li&quot;).hover(function() {	//On hover...
		$(this).find(&quot;span&quot;).stop().animate({
			marginTop: &quot;-40&quot; //Find the &lt;span&gt; tag and move it up 40 pixels
		}, 250);
	} , function() { //On hover out...
		$(this).find(&quot;span&quot;).stop().animate({
			marginTop: &quot;0&quot;  //Move the &lt;span&gt; back to its original state (0px)
		}, 250);
	});
&nbsp;
});</pre></div></div>

<p>Source: <a href="http://www.sohtanaka.com/web-design/animate-navigation-with-css-jquery/">http://www.sohtanaka.com/web-design/animate-navigation-with-css-jquery/</a><br />
Demo: <a href="http://www.sohtanaka.com/web-design/examples/fancy-navigation/final.gif">http://www.sohtanaka.com/web-design/examples/fancy-navigation/</a></p>
 <img src="http://lab.chowky.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=1010" width="1" height="1" style="display: none;" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Flab.chowky.com%2F2009%2F08%2Fjquery-animated-navigation-with-css-jquery%2F&amp;title=%5BjQuery%5D%20%E5%88%A9%E7%94%A8%20jqeury%20%E5%92%8C%20css%20%E5%BB%BA%E7%AB%8B%E4%B8%80%E5%80%8Bnavigation%20menu" id="wpa2a_4"><img src="http://lab.chowky.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://lab.chowky.com/2009/08/jquery-animated-navigation-with-css-jquery/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

