|
效果一 |
效果二 | 效果三 |
<script src="/api/jq/BootstrapCaidan/js/metismenu.js"></script>
<script>
$(function () {
$('#menu').metisMenu();
});
</script>
Include metismenu StyleSheet
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/metisMenu/2.6.1/metisMenu.min.css">
<link rel="stylesheet" href="//cdn.jsdelivr.net/jquery.metismenu/2.6.1/metisMenu.min.css">
Include jQuery
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script src="//cdn.jsdelivr.net/jquery/2.2.4/jquery.min.js"></script>
Include metisMenu plugin's code
<script src="//cdnjs.cloudflare.com/ajax/libs/metisMenu/2.6.1/metisMenu.min.js"></script>
<script src="//cdn.jsdelivr.net/jquery.metismenu/2.6.1/metisMenu.min.js"></script>
Add class metismenu to unordered list
<ul class="metismenu" id="menu"> </ul>
Make expand/collapse controls accessible
Be sure to add
aria-expandedto the elementaand the followingul. This attribute explicitly defines the current state of the collapsible element to screen readers and similar assistive technologies. If the collapsible element is closed by default, it should have a value ofaria-expanded="false". If you've set the collapsible element's parentlielement to be open by default using theactiveclass, setaria-expanded="true"on the control instead. The plugin will automatically toggle this attribute based on whether or not the collapsible element has been opened or closed.
<ul class="metismenu" id="menu">
<li class="active">
<a href="#" aria-expanded="true">Menu 1</a>
<ul aria-expanded="true">
...
</ul>
</li>
<li>
<a href="#" aria-expanded="false">Menu 2</a>
<ul aria-expanded="false">
...
</ul>
</li>
...
</ul>
has-arrow class to a element
<ul class="metismenu" id="menu">
<li class="active">
<a class="has-arrow" href="#" aria-expanded="true">Menu 1</a>
<ul aria-expanded="true">
...
</ul>
</li>
<li>
<a class="has-arrow" href="#" aria-expanded="false">Menu 2</a>
<ul aria-expanded="false">
...
</ul>
</li>
...
</ul>
Call the plugin:
$("#menu").metisMenu();
Setting aria-disabled="true" in the <a> element as
shown will stop metisMenu opening the menu for that particular list.
This can be changed dynamically and will be obeyed correctly:
<a href="#" aria-expanded="false" aria-disabled="true">List 1</a>
Type: Boolean Default: true
For auto collapse support.
$("#menu").metisMenu({
toggle: false });
Type: String Default: null
For stop and destroy metisMenu.
$("#menu").metisMenu('dispose');
Type: String Default: active
$("#menu").metisMenu({
activeClass: 'active' });
Type: String Default: collapse
$("#menu").metisMenu({
collapseClass: 'collapse' });
Type: String Default: in
$("#menu").metisMenu({
collapseInClass: 'in' });
Type: String Default: collapsing
$("#menu").metisMenu({
collapsingClass: 'collapsing' });
Type: Boolean Default: false
For double tap support.
$("#menu").metisMenu({
doubleTapToGo: true });
The doubleTapToGo option will be deprecated in the next release.
Type: Boolean Default: true
Prevents or allows dropdowns' onclick events after expanding/collapsing.
$("#menu").metisMenu({
preventDefault: false });
| Event Type | Description |
|---|---|
| show.metisMenu |
This event fires immediately when the _show instance method is called.
|
| shown.metisMenu |
This event is fired when a collapse ul element has been made visible to the user (will wait for CSS transitions to complete).
|
| hide.metisMenu |
This event is fired immediately when the _hide method has been called.
|
| hidden.metisMenu |
This event is fired when a collapse ul element has been hidden from the user (will wait for CSS transitions to complete).
|
https://github.com/onokumus/metisMenu

| 文件 | jQuery插件大全打包 |
| 内容 | HTML5+CSS3+PHP+jQuery等示例 |
| 大小 | 170M(300+个文件) |
注意:示例只是当前的内容,【下载】的是全部jQuery插件一起打包后的文件。