是否有可能通過單獨的按鈕onclick事件打開jQuery手風琴菜單中的下一個面板?這不是單擊標題打開另一個面板,而是使用未連接到手風琴的按鈕。通過事件觸發jquery手風琴菜單?
7
A
回答
13
是的,只需撥打這樣的手風琴activate
:
$("#myaccordion").accordion("activate", 1);
哪裏1
是要打開的索引。
你可以通過調用得到活動面板的電流從零開始的索引:
var index = $("#myaccordion").accordion('option','active');
所以,服用這兩種物品放在一起,我們可以打開上的點擊下一個項目:
$("#mybutton").click(function(e){
e.preventDefault();
var acc = $("#myaccordion"),
index = acc.accordion('option','active'),
total = acc.children('div').length,
nxt = index + 1;
if (nxt >= total) {
nxt = 0; // Loop around to the first item
}
acc.accordion('activate', nxt);
})
10
在JQuery UI 1.10或更高版本中,.activate函數已被棄用,以支持使用'option'方法,因此使用上述答案的另一種方法是:
$("#button").click(function(){
var index = $("#accordion").accordion('option','active');
var total = $("#accordion").children('div').length;
index++;
// include restart same as previous answer
if (index >= total) {
index = 0;
}
$("#accordion").accordion("option", "active", index);
}
相關問題
- 1. 手風琴菜單通過觸發器觸發
- 2. 觸發Jquery UI手風琴事件
- 3. jQuery的手風琴菜單
- 4. jQuery的手風琴菜單
- 5. 未觸發手風琴事件
- 6. Jquery手風琴菜單插件錯誤
- 7. 手風琴菜單
- 8. 使用JQuery UI手風琴手風琴菜單
- 9. 簡單的jQuery手風琴菜單跳
- 10. 簡單的JQuery手風琴菜單
- 11. jQuery手風琴菜單 - 保持手風琴菜單打開頁面我在
- 12. JQuery通過URL擴展嵌套式手風琴菜單
- 13. jQuery UI手風琴創建事件沒有觸發
- 14. jQuery的手風琴變化不會觸發事件
- 15. jQuery手風琴觸發元素外
- 16. 使用Monoouch觸控手機的手風琴菜單風格
- 17. 手風琴菜單jQuery的不工作
- 18. jquery菜單手風琴樣式問題
- 19. Jquery手風琴菜單問題
- 20. 不正確的jquery手風琴菜單
- 21. jQuery手風琴菜單動畫擺動
- 22. 使用jQuery的手風琴菜單
- 23. 使用JQuery定位手風琴菜單
- 24. jquery - 垂直手風琴導航菜單
- 25. Jquery手風琴菜單(3級)如何?
- 26. 手風琴jquery多菜單導航
- 27. jQuery手風琴導航菜單
- 28. Jquery在wordpress中的手風琴菜單
- 29. SharePoint 2010和JQuery手風琴菜單
- 30. 兒童手風琴發燒家長手風琴accordionactivate事件