一个jQuery导航插件,用于在涉及大量页面和/或产品的网站上创建键盘和屏幕阅读器可访问的超级菜单。
1.包括来自谷歌CDN的最新版本的jQuery库。
<script src="/path/to/cdn/jquery.min.js"></script>
2.在页面中包含jQuery Accessible Mega Menu的脚本和样式表文件。
<link rel="stylesheet" href="css/megamenu.css"> <script src="js/jquery-accessibleMegaMenu.js"></script>
3.按照Html结构创建一个巨型菜单:
<nav> <ul class="nav-menu"> <li class="nav-item"> <a href="#">jQuery</a> <div class="sub-nav"> <ul class="sub-nav-group"> <li><a href="#">jQuery 1</a></li> <li><a href="#">jQuery 2</a></li> <li>…</li> </ul> <ul class="sub-nav-group"> <li><a href="#">jQuery 3</a></li> <li><a href="#">jQuery 4</a></li> <li>…</li> </ul> <ul class="sub-nav-group"> <li><a href="#">jQuery 5</a></li> <li><a href="#">jQuery 6</a></li> <li>…</li> </ul> </div> </li> <li class="nav-item"> <a href="?tv">Zepto</a> <div class="sub-nav"> <ul class="sub-nav-group"> <li><a href="#">Zepto 1</a></li> <li><a href="#">Zepto 2</a></li> <li>…</li> </ul> <ul class="sub-nav-group"> <li><a href="#">Zepto 3</a></li> <li><a href="#">Zepto 4</a></li> <li>…</li> </ul> <ul class="sub-nav-group"> <li><a href="#">Zepto 5</a></li> <li><a href="#">Zepto 6</a></li> <li>…</li> </ul> </div> </li> </ul> </nav>
4.使用默认选项初始化超级菜单。
$(document).ready(function () { $('.megamenu').accessibleMegaMenu(); });
5.所有设置。
$('.megamenu').accessibleMegaMenu({ // unique ID's are required to indicate aria-owns, aria-controls and aria-labelledby uuidPrefix: "accessible-megamenu", // default css class used to define the megamenu styling menuClass: "accessible-megamenu", // default css class for a top-level navigation item in the megamenu topNavItemClass: "accessible-megamenu-top-nav-item", // default css class for a megamenu panel panelClass: "accessible-megamenu-panel", // default css class for a group of items within a megamenu panel panelGroupClass: "accessible-megamenu-panel-group", // default css class for the hover state hoverClass: "hover", // default css class for the focus state focusClass: "focus", // default css class for the open state}); openClass: "open", // default open delay when opening menu via mouseover openDelay: 0, // default open delay when opening menu via mouseover closeDelay: 250 });
2022-04-26
2022-04-23
2018-05-12
2017-07-29
2017-07-28
2017-03-25
2015-05-21
2014-08-28
2014-04-03
2014-03-07
2014-01-22