Switching from a horizontal drop-down menu to a vertical fly-out menu couldn't be easier. We'll use the same HTML markup and our JavaScript code will stay the same. The only change we'll need to make is to add some new CSS to make our menu display vertically instead of horizontally. We can keep working with the same files we used in the last example.
css
folder of the Superfish download, you'll find a file named superfish-vertical.css
. Copy that file to your own styles
folder. In the head
section of the HTML file, we'll attach the new CSS file. Between superfish.css
and styles.css
, add the new CSS file:<link rel="stylesheet" href="styles/superfish.css"/> <link rel="stylesheet" href="styles/superfish-vertical.css"/> <link rel="stylesheet" href="styles/styles.css"/>
sf-vertical
class to the list that contains our menu.<ul id="sfNav" class="sf-menu sf-vertical">
What just happened?
The only difference between the horizontal drop-down menu and the vertical fly-out menu is the CSS and a class name added to the menu container. By simply adding a new CSS file and a new CSS class, it's possible to create a vertical fly-out menu instead of a horizontal drop-down menu.
3.142.98.108