<?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>FVF.me&#039;Ye &#187; 下拉列表</title>
	<atom:link href="http://fvf.me/tag/%e4%b8%8b%e6%8b%89%e5%88%97%e8%a1%a8/feed" rel="self" type="application/rss+xml" />
	<link>http://fvf.me</link>
	<description>我是孤独的根号5</description>
	<lastBuildDate>Mon, 19 Sep 2011 12:10:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>下拉列表导航栏</title>
		<link>http://fvf.me/wordpress/tips/wordpress-theme-navigation-bar-of-the-drop-down-list.html</link>
		<comments>http://fvf.me/wordpress/tips/wordpress-theme-navigation-bar-of-the-drop-down-list.html#comments</comments>
		<pubDate>Wed, 05 Aug 2009 11:04:25 +0000</pubDate>
		<dc:creator>死兔子</dc:creator>
				<category><![CDATA[小技巧]]></category>
		<category><![CDATA[下拉列表]]></category>
		<category><![CDATA[分类]]></category>
		<category><![CDATA[导航栏]]></category>

		<guid isPermaLink="false">http://fvf.me/wordpress/wordpress-theme-navigation-bar-of-the-drop-down-list.html</guid>
		<description><![CDATA[看到别人的导航栏是下拉列表式的，就只有一个感觉，羡慕。但是我又不想单单为了这个功能去用上一个插件，怎么办呢？自己动手呗！可是在Google上找了很多的导航栏样式，都很漂亮，但漂亮的代价也是沉重的！为了漂亮而付出速度那是不行的！所以找来找去，终于找到了简单的导航栏方法！ 哈哈！其实我想要得就是想在导航栏上加上分类下拉式导航，当然想要加其他的方法都是一样的，就是li里面套li啊，不过对我来说没什么意义！ 先当然是该html代码了，加上分类的导航链接就是在主导航栏ul之下再加也一个li项。 &#60;li class=&#34;cat-item&#34;&#62;&#60;a href=&#34;#&#34;&#62;分类Categories&#60;/a&#62; &#60;ul class=&#34;children&#34;&#62; &#60;?php wp_list_categories(&#39;orderby=name&#38;title_li=&#39;); $this_category = get_category($cat); if (get_category_children($this_category-&#62;cat_ID) != &#34;&#34;) { echo &#34;&#60;/ul&#62;&#60;ul&#62;&#34;; wp_list_categories(&#39;orderby=id&#38;show_count=0&#38;title_li= &#38;use_desc_for_title=1&#38;child_of=&#39;.$this_category-&#62;cat_ID); echo &#34;&#60;/ul&#62;&#34;; } ?&#62; &#60;/li&#62; 接下来就是CSS代码了，这个需要自己调试了。 #nav { } #nav ul { } #nav li { } #nav li a {, } #nav li a:hover { } #nav li ul { } #nav [...]]]></description>
			<content:encoded><![CDATA[<p>看到别人的导航栏是下拉列表式的，就只有一个感觉，羡慕。但是我又不想单单为了这个功能去用上一个插件，怎么办呢？自己动手呗！可是在Google上找了很多的导航栏样式，都很漂亮，但漂亮的代价也是沉重的！为了漂亮而付出速度那是不行的！所以找来找去，终于找到了简单的导航栏方法！</p>
<p>哈哈！其实我想要得就是想在导航栏上加上分类下拉式导航，当然想要加其他的方法都是一样的，就是li里面套li啊，不过对我来说没什么意义！</p>
<p>先当然是该html代码了，加上分类的导航链接就是在主导航栏ul之下再加也一个li项。</p>
<div class="source" style="font-family: 'Courier New', 'Lucida Console', Verdana; color: rgb(192, 192, 192); background-color: rgb(0, 0, 0); "> <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;li</span> <span style="color: rgb(255, 255, 0); ">class=</span><span style="color: rgb(187, 187, 0); ">&quot;cat-item&quot;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&gt;&lt;a</span> <span style="color: rgb(255, 255, 0); ">href=</span><span style="color: rgb(187, 187, 0); ">&quot;#&quot;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&gt;</span><span style="color: rgb(192, 192, 192); ">分类Categories</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/a&gt;</span><br /> <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;ul</span> <span style="color: rgb(255, 255, 0); ">class=</span><span style="color: rgb(187, 187, 0); ">&quot;children&quot;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&gt;</span><br /> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(192, 192, 192); ">wp_list_categories</span>(<span style="color: rgb(187, 187, 0); ">&#39;orderby=name&amp;title_li=&#39;</span>);<br /> <span style="color: rgb(204, 204, 0); ">$this_category</span> <span style="color: rgb(192, 192, 192); ">=</span> <span style="color: rgb(192, 192, 192); ">get_category</span>(<span style="color: rgb(204, 204, 0); ">$cat</span>);<br /> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span> (<span style="color: rgb(192, 192, 192); ">get_category_children</span>(<span style="color: rgb(204, 204, 0); ">$this_category</span><span style="color: rgb(192, 192, 192); ">-&gt;</span><span style="color: rgb(255, 255, 0); ">cat_ID</span>) <span style="color: rgb(192, 192, 192); ">!=</span> <span style="color: rgb(187, 187, 0); ">&quot;&quot;</span>) <span style="color: rgb(192, 192, 192); ">{</span><br /> <span style="color: rgb(255, 255, 0); font-weight: bold; ">echo</span> <span style="color: rgb(187, 187, 0); ">&quot;&lt;/ul&gt;&lt;ul&gt;&quot;</span>;<br /> <span style="color: rgb(192, 192, 192); ">wp_list_categories</span>(<span style="color: rgb(187, 187, 0); ">&#39;orderby=id&amp;show_count=0&amp;title_li=</span><br /> <span style="color: rgb(187, 187, 0); ">&amp;use_desc_for_title=1&amp;child_of=&#39;</span><span style="color: rgb(192, 192, 192); ">.</span><span style="color: rgb(204, 204, 0); ">$this_category</span><span style="color: rgb(192, 192, 192); ">-&gt;</span><span style="color: rgb(255, 255, 0); ">cat_ID</span>);<br /> <span style="color: rgb(255, 255, 0); font-weight: bold; ">echo</span> <span style="color: rgb(187, 187, 0); ">&quot;&lt;/ul&gt;&quot;</span>;<br /> <span style="color: rgb(192, 192, 192); ">}</span><br /> <span style="color: rgb(255, 255, 255); ">?&gt;</span><br /> <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/li&gt;</span></div>
<p>接下来就是CSS代码了，这个需要自己调试了。</p>
<div class="source" style="font-family: 'Courier New', 'Lucida Console', Verdana; color: rgb(192, 192, 192); background-color: rgb(0, 0, 0); "> <span style="color: rgb(255, 255, 0); ">#nav</span> <span style="color: rgb(192, 192, 192); ">{</span><br /> <span style="color: rgb(192, 192, 192); ">}</span><br /> <span style="color: rgb(255, 255, 0); ">#nav</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">ul</span> <span style="color: rgb(192, 192, 192); ">{</span><br /> <span style="color: rgb(192, 192, 192); ">}</span><br /> <span style="color: rgb(255, 255, 0); ">#nav</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">li</span> <span style="color: rgb(192, 192, 192); ">{</span><br /> <span style="color: rgb(192, 192, 192); ">}</span><br /> <span style="color: rgb(255, 255, 0); ">#nav</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">li</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">a</span> <span style="color: rgb(192, 192, 192); ">{</span><span style="color: rgb(192, 192, 192); ">,</span><br /> <span style="color: rgb(192, 192, 192); ">}</span><br /> <span style="color: rgb(255, 255, 0); ">#nav</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">li</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">a</span><span style="color: rgb(192, 192, 192); ">:hover</span> <span style="color: rgb(192, 192, 192); ">{</span><br /> <span style="color: rgb(192, 192, 192); ">}</span><br /> <span style="color: rgb(255, 255, 0); ">#nav</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">li</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">ul</span> <span style="color: rgb(192, 192, 192); ">{</span><br /> <span style="color: rgb(192, 192, 192); ">}</span><br /> <span style="color: rgb(255, 255, 0); ">#nav</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">li</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">ul</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">li</span> <span style="color: rgb(192, 192, 192); ">{</span><br /> <span style="color: rgb(192, 192, 192); ">}</span><br /> <span style="color: rgb(255, 255, 0); ">#nav</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">li</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">ul</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">li</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">a</span> <span style="color: rgb(192, 192, 192); ">{</span><br /> <span style="color: rgb(192, 192, 192); ">}</span><br /> <span style="color: rgb(255, 255, 0); ">#nav</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">li</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">ul</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">li</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">a</span><span style="color: rgb(192, 192, 192); ">:hover</span> <span style="color: rgb(192, 192, 192); ">{</span><br /> <span style="color: rgb(192, 192, 192); ">}</span><br /> <span style="color: rgb(255, 255, 0); ">#nav</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">li</span><span style="color: rgb(192, 192, 192); ">:hover</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">ul</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">ul</span><span style="color: rgb(192, 192, 192); ">,</span> <span style="color: rgb(255, 255, 0); ">#nav</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">li</span><span style="color: rgb(192, 192, 192); ">.sfhover</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">ul</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">ul</span> <span style="color: rgb(192, 192, 192); ">{</span><br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">left</span><span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(192, 192, 192); ">-999em</span>;<br /> <span style="color: rgb(192, 192, 192); ">}</span><br /> <span style="color: rgb(255, 255, 0); ">#nav</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">li</span><span style="color: rgb(192, 192, 192); ">:hover</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">ul</span><span style="color: rgb(192, 192, 192); ">,</span> <span style="color: rgb(255, 255, 0); ">#nav</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">li</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">li</span><span style="color: rgb(192, 192, 192); ">:hover</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">ul</span><span style="color: rgb(192, 192, 192); ">,</span> <span style="color: rgb(255, 255, 0); ">#nav</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">li</span><span style="color: rgb(192, 192, 192); ">.sfhover</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">ul</span><span style="color: rgb(192, 192, 192); ">,</span> <span style="color: rgb(255, 255, 0); ">#nav</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">li</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">li</span><span style="color: rgb(192, 192, 192); ">.sfhover</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">ul</span> <span style="color: rgb(192, 192, 192); ">{</span><br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">left</span><span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">auto</span>;<br /> <span style="color: rgb(192, 192, 192); ">}</span></div>
<p>最后就是对万恶的IE6的兼容了，因为IE6中只支持啊a：hover，而不支持其他的：hover，你应当看到上面的css中有一些代码不能运行啊！所以需要Javascript脚本支持。</p>
<div class="source" style="font-family: 'Courier New', 'Lucida Console', Verdana; color: rgb(192, 192, 192); background-color: rgb(0, 0, 0); "> <span style="color: rgb(192, 192, 192); ">sfHover</span> <span style="color: rgb(192, 192, 192); ">=</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">function</span>() <span style="color: rgb(192, 192, 192); ">{</span><br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">var</span> <span style="color: rgb(192, 192, 192); ">sfEls</span> <span style="color: rgb(192, 192, 192); ">=</span> <span style="color: rgb(192, 192, 192); ">document</span><span style="color: rgb(192, 192, 192); ">.</span><span style="color: rgb(192, 192, 192); ">getElementById</span>(<span style="color: rgb(187, 187, 0); ">&quot;nav&quot;</span><span style="color: rgb(192, 192, 192); ">).</span><span style="color: rgb(192, 192, 192); ">getElementsByTagName</span>(<span style="color: rgb(187, 187, 0); ">&quot;LI&quot;</span>);<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">for</span> (<span style="color: rgb(255, 255, 0); font-weight: bold; ">var</span> <span style="color: rgb(192, 192, 192); ">i</span><span style="color: rgb(192, 192, 192); ">=</span><span style="color: rgb(192, 192, 192); ">0</span>; <span style="color: rgb(192, 192, 192); ">i</span><span style="color: rgb(192, 192, 192); ">&lt;</span><span style="color: rgb(192, 192, 192); ">sfels</span> <span style="color: rgb(192, 192, 192); ">.</span><span style="color: rgb(192, 192, 192); ">length</span>; <span style="color: rgb(192, 192, 192); ">i</span><span style="color: rgb(192, 192, 192); ">++</span>) <span style="color: rgb(192, 192, 192); ">{</span><br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(192, 192, 192); ">sfEls</span><span style="color: rgb(192, 192, 192); ">[</span><span style="color: rgb(192, 192, 192); ">i</span><span style="color: rgb(192, 192, 192); ">].</span><span style="color: rgb(192, 192, 192); ">onmouseover</span><span style="color: rgb(192, 192, 192); ">=</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">function</span>() <span style="color: rgb(192, 192, 192); ">{</span><br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">this</span><span style="color: rgb(192, 192, 192); ">.</span><span style="color: rgb(192, 192, 192); ">className</span><span style="color: rgb(192, 192, 192); ">+=</span><span style="color: rgb(187, 187, 0); ">&quot; sfhover&quot;</span>;<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(192, 192, 192); ">}</span><br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(192, 192, 192); ">sfEls</span><span style="color: rgb(192, 192, 192); ">[</span><span style="color: rgb(192, 192, 192); ">i</span><span style="color: rgb(192, 192, 192); ">].</span><span style="color: rgb(192, 192, 192); ">onmouseout</span><span style="color: rgb(192, 192, 192); ">=</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">function</span>() <span style="color: rgb(192, 192, 192); ">{</span><br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">this</span><span style="color: rgb(192, 192, 192); ">.</span><span style="color: rgb(192, 192, 192); ">className</span><span style="color: rgb(192, 192, 192); ">=</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">this</span><span style="color: rgb(192, 192, 192); ">.</span><span style="color: rgb(192, 192, 192); ">className</span><span style="color: rgb(192, 192, 192); ">.</span><span style="color: rgb(192, 192, 192); ">replace</span>(<span style="color: rgb(255, 255, 0); font-weight: bold; ">new</span> <span style="color: rgb(192, 192, 192); ">RegExp</span>(<span style="color: rgb(187, 187, 0); ">&quot; sfhover\\b&quot;</span><span style="color: rgb(192, 192, 192); ">),</span> <span style="color: rgb(187, 187, 0); ">&quot;&quot;</span>);<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(192, 192, 192); ">}</span><br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(192, 192, 192); ">}</span><br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(192, 192, 192); ">}</span><br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span> (<span style="color: rgb(192, 192, 192); ">window</span><span style="color: rgb(192, 192, 192); ">.</span><span style="color: rgb(192, 192, 192); ">attachEvent</span>) <span style="color: rgb(192, 192, 192); ">window</span><span style="color: rgb(192, 192, 192); ">.</span><span style="color: rgb(192, 192, 192); ">attachEvent</span>(<span style="color: rgb(187, 187, 0); ">&quot;onload&quot;</span><span style="color: rgb(192, 192, 192); ">,</span> <span style="color: rgb(192, 192, 192); ">sfHover</span>);<br /> <span style="color: rgb(192, 192, 192); ">&lt;</span><span style="color: rgb(192, 192, 192); ">/sfels&gt;</span></div>
]]></content:encoded>
			<wfw:commentRss>http://fvf.me/wordpress/tips/wordpress-theme-navigation-bar-of-the-drop-down-list.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

