<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
  <channel>
    <title>Recent Posts in 'Adding a drop down menu' | Pragmatic Forums</title>
    <link>http://fora.pragprog.com/forums/45/topics/497</link>
    <language>en-us</language>
    <ttl>60</ttl>
    <description></description>
    <item>
      <title>Adding a drop down menu posted by Christophe Porteneuve @ Mon, 02 Jun 2008 22:54:19 -0000</title>
      <description>&lt;p&gt;Hey Mike,&lt;/p&gt;


	&lt;p&gt;Essentially, you should try and style your menu items so that they appear in the proper positions by default, all shown.  Use a first-level list for the top navbar, and inner lists inside the &lt;code&gt;&amp;lt;li&amp;gt;&lt;/code&gt;&amp;#8217;s that have submenus.  Then, you should hide the inner lists by default (using inline &lt;code&gt;style="display: none;"&lt;/code&gt;), and toggle them using mouseover/mouseout on the relevant &lt;code&gt;&amp;lt;li&amp;gt;&lt;/code&gt;&amp;#8217;s in the top list.&lt;/p&gt;


	&lt;p&gt;The markup would go like this:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;&amp;lt;ul id="navBar"&amp;gt;
  &amp;lt;li&amp;gt;&amp;lt;a href="&#8230;"&amp;gt;No Sub Menu&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
  &amp;lt;li&amp;gt;
     &amp;lt;a href="/cat2"&amp;gt;Submenu here&amp;lt;/a&amp;gt;
     &amp;lt;ul id="cat2"&amp;gt;
       &amp;lt;li&amp;gt;Subitem 1&amp;lt;/li&amp;gt;
       &amp;lt;li&amp;gt;Subitem 2&amp;lt;/li&amp;gt;
       &#8230;
     &amp;lt;/ul&amp;gt;
  &amp;lt;/li&amp;gt;
  &#8230;
&amp;lt;/ul&amp;gt;&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Then you should style those using a &lt;code&gt;position: relative&lt;/code&gt; for list items, and a &lt;code&gt;position: absolute&lt;/code&gt; with proper top/left positioning for inner lists.  Perhaps something alone these lines:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;#navBar li { position: relative; height: 1em; padding: 0.5em; }
#navBar li ul { position: absolute; top: 2em; left: 0; }
&#8230;&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;When it renders well on all browsers you want to support, add the inline hiding and event-based &lt;code&gt;hide&lt;/code&gt;/&lt;code&gt;show&lt;/code&gt; calls.&lt;/p&gt;


	&lt;p&gt;&amp;#8216;HTH&lt;/p&gt;</description>
      <pubDate>Mon, 02 Jun 2008 22:54:19 -0000</pubDate>
      <guid isPermaLink="false">fora.pragprog.com:45:497:3020</guid>
      <author>Christophe Porteneuve</author>
      <link>http://fora.pragprog.com/forums/45/topics/497</link>
    </item>
    <item>
      <title>Adding a drop down menu posted by Mike E. @ Mon, 02 Jun 2008 16:25:50 -0000</title>
      <description>&lt;p&gt;Hi Christophe,&lt;/p&gt;


	&lt;p&gt;Thanks for the reply. I think I understand what you&amp;#8217;re saying. The problem is I don&amp;#8217;t know &lt;span class="caps"&gt;CSS&lt;/span&gt; well enough to grab the relevant bits from the site you recommend. I&amp;#8217;m having trouble integrating it with the &lt;span class="caps"&gt;CSS&lt;/span&gt; on my site. I&amp;#8217;m really new at this. I&amp;#8217;ve tried several times to make it work on my site, but I end up screwing up my site.&lt;/p&gt;


	&lt;p&gt;Mike&lt;/p&gt;</description>
      <pubDate>Mon, 02 Jun 2008 16:25:50 -0000</pubDate>
      <guid isPermaLink="false">fora.pragprog.com:45:497:3017</guid>
      <author>Mike E.</author>
      <link>http://fora.pragprog.com/forums/45/topics/497</link>
    </item>
    <item>
      <title>Adding a drop down menu posted by Christophe Porteneuve @ Mon, 02 Jun 2008 06:14:02 -0000</title>
      <description>&lt;p&gt;Have a look at the &lt;a href="http://www.scti.fr"&gt;&lt;span class="caps"&gt;SCTI&lt;/span&gt; website&lt;/a&gt; I did a while back, which does what you want.  It uses semantic markup for the menu (nested lists) and JavaScript to react to mouseover/mouseout&amp;#8217;s by hiding/showing the sublists.  &lt;span class="caps"&gt;CSS&lt;/span&gt; positions the menus.  The script (&lt;code&gt;/js/scti.js&lt;/code&gt;) could be taken one step further by using event delegation + target identification instead of attaching handlers to every single top-level menu item.&lt;/p&gt;


	&lt;p&gt;&amp;#8216;HTH&lt;/p&gt;</description>
      <pubDate>Mon, 02 Jun 2008 06:14:02 -0000</pubDate>
      <guid isPermaLink="false">fora.pragprog.com:45:497:3011</guid>
      <author>Christophe Porteneuve</author>
      <link>http://fora.pragprog.com/forums/45/topics/497</link>
    </item>
    <item>
      <title>Adding a drop down menu posted by Mike E. @ Mon, 02 Jun 2008 01:52:57 -0000</title>
      <description>&lt;p&gt;I&amp;#8217;m using tabbed navigation menus on my site. I&amp;#8217;d like to add a drop down menu to the &amp;#8216;products&amp;#8217; tab, something like Widget1, Widget2, Widget3, etc. I&amp;#8217;ve tried to get it to work but I&amp;#8217;m just not getting it.&lt;/p&gt;


	&lt;p&gt;Here&amp;#8217;s a very stripped down version of the site:&lt;br /&gt;&lt;a href="http://64.58.198.103/www.PRACTICE_MENUS.com/home.html"&gt;http://64.58.198.103/www.PRACTICE_MENUS.com/home.html&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;When the mouse moves over the rectangular &amp;#8216;products&amp;#8217; box, a drop down menu should appear.&lt;/p&gt;


	&lt;p&gt;Any help would really be appreciated.&lt;/p&gt;


	&lt;p&gt;Thanks,&lt;br /&gt;Mike&lt;/p&gt;</description>
      <pubDate>Mon, 02 Jun 2008 01:52:57 -0000</pubDate>
      <guid isPermaLink="false">fora.pragprog.com:45:497:3009</guid>
      <author>Mike E.</author>
      <link>http://fora.pragprog.com/forums/45/topics/497</link>
    </item>
  </channel>
</rss>
