Note that there are some explanatory texts on larger screens.

plurals
  1. POJQuery Horizontal Accordion CSS
    primarykey
    data
    text
    <p>I'm trying to build a simple multi-level UL Horizontal Accordion (or slide menu) in Jquery. Hunter Daley graciously provided the Jquery code, but I can't seem to figure out the css. I know this is newb, but I'm really stuck.</p> <p>When Ul li Ul slides out it creates a linebreak, I'd like to have everything display inline, with no breaks. I've tried whitespace: nowrap, display inline etc It just won't seem to do it. Any ideas?</p> <p>As per, Glavic's answer: I was trying to to use floats, but if I do Safari bugs out and flash the sub-level UL during the animation:</p> <p><strong>Using Floats:</strong></p> <p>Right, I was trying to do it without floats. I'm trying to stick with the animation function.</p> <p>Safari bugs out and flashes the sub ul during the animation.</p> <pre><code>&lt;style type="text/css"&gt; &lt;!-- body { font-size: 1em; line-height: 1em; } ul { background-color: yellow; list-style: none; margin: 0; padding: 0; height: 1em; float: left; } ul li { background-color: aqua; float: left; } ul li ul { background-color: blue; } ul li ul li { background-color: green; } a, a:link, a:hover, a:visited, a:active { color: black; text-decoration: none; float: left; } --&gt; &lt;/style&gt; </code></pre> <p><strong>Original Post:</strong></p> <p></p> <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"/&gt; &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"&gt;&lt;/script&gt; &lt;title&gt;untitled&lt;/title&gt; &lt;style type="text/css"&gt; &lt;!-- ul{ list-style: none; background-color: yellow; margin: 0; padding: 0; white-space: nowrap; } ul li { background-color: aqua; display: inline; } ul li ul { background-color: blue; } ul li ul li { background-color: green; } a, a:link, a:hover, a:visited, a:active { color: black; text-decoration: none; } --&gt; &lt;/style&gt; &lt;script type="text/javascript"&gt; var $current = null; $(document).ready(function(){ $("ul li ul").hide(); // hide submenus by default on load $("ul li a").click(function(){ var $sub = $(this).next(); if ($sub.css("display") == "none") { if ($current != null) $current.animate({ width: 'hide' }); // if you want to only show one sub at a time $sub.animate({ width: 'show' }); $current = $sub; } else { $sub.animate({ width: 'hide' }); $current = null; } }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;ul&gt; &lt;li&gt; &lt;a href="#"&gt;Top-level 1&lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="#"&gt;Top-level 2&lt;/a&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#"&gt;Bottom Level A1&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Bottom Level A2&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Bottom Level A3&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Bottom Level A4&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="#"&gt;Top-level 3&lt;/a&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#"&gt;Bottom Level B1&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Bottom Level B2&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="#"&gt;Top-level 4&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload