Get started with superfish CDN
MIT licensed
Superfish is a jQuery plugin that enhances the look and functionality of dropdown menus.
Tags:- dropdown
- jquery
- menu
- superfish
- super fish
Stable version
Copied!
How to start using superfish CDN
<!DOCTYPE html>
<html>
<head>
<title>Get started with superfish CDN - cdnhub.io</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.cdnhub.io/superfish/1.7.10/css/superfish.css" />
<script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js"></script>
<script src="https://cdn.cdnhub.io/superfish/1.7.10/js/superfish.min.js"></script>
<style>
.navbar-nav > li > a:hover {
color: #4CAF50;
}
</style>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="#">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Features</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="dropdown01" data-bs-toggle="dropdown" aria-expanded="false">Dropdown</a>
<ul class="dropdown-menu" aria-labelledby="dropdown01">
<li><a class="dropdown-item" href="#">Action</a></li>
<li><a class="dropdown-item" href="#">Another action</a></li>
<li><a class="dropdown-item" href="#">Something else here</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<div class="container my-5">
<p>SuperFish is a drop-down menu plugin for the jQuery library. It enhances the default drop-down menus created by the Bootstrap framework.</p>
</div>
<script>
$(document).ready(function() {
$('ul.dropdown-menu [data-toggle="dropdown"]').on('click', function(event) {
// Avoid following the href location when clicking
event.preventDefault();
// Avoid having the menu toggle open on click
event.stopPropagation();
// Dropdown is open - prevent anything else from responding to click events
if ($(this).parent().hasClass('open')) {
return;
}
// Toggle open/close
$(this).parent().toggleClass('open');
});
$('ul.dropdown-menu').superfish();
});
</script>
</body>
</html>
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!