線上預覽 下載
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