Time for action – improving the drop-down menu with jQuery
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 ...
Get jQuery for Designers Beginner's Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.