今天介紹前端js插件菜單系列(3)右鍵菜單SlwCtxMenu,導航菜單SlwMenu。
基於jQuery,瀏覽器兼容(Browser Support)
- Internet Explorer: 7, 8, 9, 10, 11
- Chrome
- Edge
- Firefox
- Safari
- Opera
1、右鍵菜單SlwCtxMenu
var callbackFun = {
'copy' : function(li) {
alert('copy');
},
'cut' : function(li) {
alert('cut');
},
'del' : function(li) {
alert('del');
},
'paste' : function(li) {
alert('paste');
}
};
$('#menuDiv1').slwCtxMenu('menu1', {
init : function(el, menu) {
menu.find('[rel=paste]').hide();
},
callback : callbackFun
});
源碼:https://github.com/wang-weidong/SlwCtxMenu
Demo: https://wang-weidong.github.io/SlwCtxMenu/demo/index.html
2、導航菜單SlwMenu
(1)基於Html標籤渲染
(2)基於Ajax請求json數據渲染