2014-10-18 124 views
0

有沒有人試過jQuery-contextMenu Bootstrap圖標?jquery contextmenu與引導3 glyphicons

樣品JS代碼:

$(function(){ 
    $.contextMenu({ 
     selector: '.context-menu-one', 
     items: { 
      "edit": {name: "Edit", icon: "glyphicon glyphicon-edit"}, 
      "cut": {name: "Cut", icon: "cut"}, 
      "copy": {name: "Copy", icon: "copy"}, 
      "paste": {name: "Paste", icon: "paste"}, 
      "delete": {name: "Delete", icon: "delete"}, 
      "sep1": "---------", 
      "quit": {name: "Quit", icon: "quit"} 
     } 
    }); 
}); 

是有任何其他方式在引導創建多級文本菜單?

+0

這是完美的一個在web – Innodel 2014-10-18 05:57:15

+0

上下文菜單工作,但它不工作,因爲jQuerycontextMenu無法找到相同的圖標,有沒有什麼辦法添加服裝圖標路徑? – Ganesh 2014-10-18 06:18:01

+0

像http://jsfiddle.net/arunpjohny/kjLxwq88/1/? – 2014-10-18 06:32:05

回答

2

看看this鏈接。這是文本菜單式引導的,所以你不會得到任何問題,而使用it.Hope這有助於

+0

是的,我已經試過這個,但它不支持多級別/子菜單... :( – Ganesh 2014-10-18 06:45:08

+1

)比我可以說你沒有做足夠的研究這個。看看[這個](http:// demo .code-abc.com/tcm/example /)示例,子菜單像魅力一樣工作 – Innodel 2014-10-18 06:49:43

+0

感謝它的工作...... :) – Ganesh 2014-10-18 08:06:24

2

Use Font Awesome Icons in CSS

這裏指定您可以更改CSS在jquery.contextMenu.css爲圖標的例如

原始

.context-menu-item.icon-edit { 
    background-image: url(images/edit.png); 
} 

.context-menu-item.icon-edit { 
    position: relative; 
} 
.context-menu-item.icon-edit:before { 
    content:"\270f"; 
    font-family: "Glyphicons Halflings"; 
    left: 5px; 
    position: absolute; 
    top: 5; 
}