ssMenu是一款jQuery固定侧边栏插件。
使用方法
在页面中引入ss-menu.css、jquery和ss-menu.js文件。
< link rel = "stylesheet" href = "css/ss-menu.css" >
< script src = "js/jquery.min.js" type = "text/javascript" ></ script >
< script src = "js/ss-menu.js" ></ script >
|
HTML结构
菜单的HTML结果如下。
<!--Start Side Sticky Menu-->
< nav class = "ss-menu " >
< ul >
< li >< a href = "#1" >< i class = "fa fa-android" ></ i > Apps Development</ a ></ li >
< li >< a href = "#1" > < span class = "ss-badge" >6</ span > < i class = "fa fa-bar-chart" ></ i > Business & Marketing </ a ></ li >
< li >< a href = "#1" >< i class = "fa fa-heartbeat" ></ i > Life Insurance</ a ></ li >
< li >< a href = "#1" >< i class = "fa fa-bank" ></ i > Bank Loans</ a ></ li >
< li >< a href = "#1" >< i class = "fa fa-cc-paypal" ></ i > Bank Marketing</ a ></ li >
< li >< a href = "#1" >< i class = "fa fa-bookmark-o" ></ i > Insurance Policies </ a ></ li >
< li >< a href = "#1" >< i class = "fa fa-car" ></ i > Vehicle Insurance </ a ></ li >
< li >< a href = "#1" >< i class = "fa fa-briefcase" ></ i > Online Insurance</ a ></ li >
< li >< a href = "#1" >< i class = "fa fa-location-arrow" ></ i > Nearest Bank</ a ></ li >
</ ul >
</ nav >
<!--End Side Sticky Menu-->
|
初始化插件
在页面DOM元素加载完毕之后,通过下面的方法来初始化插件。
$(document).ready( function (){
$( ".ss-menu" ).ssMenu();
});
|
要使用不同的主题效果,可以在配置参数中设置。
$(document).ready( function (){
$( ".ss-menu" ).ssMenu({
theme: "theme-name" ,
});
});
|
可用的主题名称有:
- red
- yellow
- blue
- green
- orange
- brown
- teal
- purple