Follow these steps to improve the usability of the drop-down menu with jQuery:
We'll begin by attaching the Superfish plugin to our HTML page at the bottom of our file, between jQuery and our
scripts.js
file:<script src="scripts/jquery.js"></script> <script src="scripts/superfish.js"></script> <script src="scripts/scripts.js"></script> </body> </html>
Next, open
scripts.js
, where we will write our code calling thesuperfish()
method. As usual, we'll get started with the document ready statement so that our script runs as soon as the page is loaded into the browser:$(document).ready(function(){ // Our code will go here. });
Looking at the documentation for the Superfish plugin, we see that we only have to select the element or elements that we'd like to apply the behavior to and then call the
superfish()
method. Inside ourready()
method, we'll add the following code:$(document...