我目前在导航部分实现了基于jquery的手风琴,但导航的某些部分不需要是手风琴的一部分(如果没有类别等)我只是想知道是否可以禁用部分手风琴与否?
我觉得这可能是不可能的,但这个网站让我感到惊讶:)
非常感谢.
小智 21
由于事件的绑定顺序,以前的技巧不起作用,但以下工作:
// Add the class ui-state-disabled to the headers that you want disabled
$( ".whatyouwant" ).addClass("ui-state-disabled");
// Now the hack to implement the disabling functionality
var accordion = $( "#accordion" ).data("accordion");
accordion._std_clickHandler = accordion._clickHandler;
accordion._clickHandler = function( event, target ) {
var clicked = $( event.currentTarget || target );
if (! clicked.hasClass("ui-state-disabled")) {
this._std_clickHandler(event, target);
}
};
Run Code Online (Sandbox Code Playgroud)
每当要激活选项卡时,请执行以下操作:
// Remove the class ui-state-disabled to the headers that you want to enable
$( ".whatyouwant" ).removeClass("ui-state-disabled");
Run Code Online (Sandbox Code Playgroud)
而已
您可以对要禁用的事物进行分类。
然后做 :
jQuery(".toDisable").live("click", function (){return false;});
Run Code Online (Sandbox Code Playgroud)
或类似的东西