该API说你不能禁用活动选项卡,我认为这是我的问题的关键。麻烦禁用jQuery UI选项卡
我在一个UI选项卡中有六个选项卡。在ajax调用之后,其中一个选项卡有时为空,以便根据用户点击新的UI手风琴选项来填充所有选项卡。每当用户进行新选择时,我都会使用“零”选项卡作为默认选定选项卡。
我使用以下代码在PHP文件中加载有时为空的选项卡,以在其为空时禁用选项卡。它可以正常工作,除非用户在单击新的UI手风琴选项时选择了此选项卡。在这种情况下,空标签将保持启用状态。
?>
<script type="text/javascript">
$(document).ready(function() {
$("#tabs").tabs("option", "disabled", false);
});
</script>
<?php
}else{
?>
<script type="text/javascript">
$(document).ready(function() {
$("#tabs").tabs("option", "disabled", [2]);
});
</script>
有人可以建议一个战术?
下面是一个包含Ajax调用脚本:
<script type="text/javascript">
$('.stallion').live('click', function(){
var id = parseInt(this.id); // Get stallion_ID from clicked "a" tag id.
activestallion(id); // Function to indicate clicked Stallion in Stallion Accordion
// Start loading Overview Tab
var request = $.ajax({
url: "stalliondetails.php",
type: "GET",
data: {stallion_ID : id}
});
request.done(function(html){
$("#tabs-1").html(html);
$("#tabs").tabs("option", "selected", 0);
$(".activehorse").fadeOut('1000', function(){
document.getElementById("activehorsename").innerHTML
=document.getElementById(id).innerHTML;
$(".activehorse").fadeIn('1000');
});
$("#tabs").tabs("select" , 0);
});
// Overview Tab load finished.
//Pedigree Tab load starting.
var request = $.ajax({
url: "pedigreedetails.php",
type: "GET",
data: {stallion_ID : id},
success: function(html){
$("#tabs-2").html(html);
}
});
//Pedigree Tab load finished.
//Progeny Tab load starting.
var request = $.ajax({
url: "progenydetails.php",
type: "GET",
data: {stallion_ID : id},
success: function(html){
$("#tabs-3").html(html);
}
});
//Progeny Tab load finished.
//News Tab load starting.
var request = $.ajax({
url: "newsdetails.php",
type: "GET",
data: {stallion_ID : id},
success: function(html){
$("#tabs-4").html(html);
}
});
//News Tab load finished.
//Race Record Tab load starting.
var request = $.ajax({
url: "racerecorddetails.php",
type: "GET",
data: {stallion_ID : id},
success: function(html){
$("#tabs-5").html(html);
}
});
//Race Record Tab load finished.
//Analysis Tab load starting.
var request = $.ajax({
url: "analysisdetails.php",
type: "GET",
data: {stallion_ID : id},
success: function(html){
$("#tabs-6").html(html);
}
});
//Analysis Tab load finished.
//Update the Seasons Request form to this Stallion.
updateseasons(id);
$("#tabs").tabs("option", "selected", 0);
$("button").button() ;
});
</script>
感谢您的帮助。
使用:$(“#tabs”).tabs(“option”,“disabled”,2); – user1028866
使用: $(“#tabs”).tabs(“option”,“disabled”,2); (“#tabs”).tabs(“option”,“disabled”,[2]);代替: 不起作用。花了我一段时间来找到有效的方括号。我所展示的代码除非在第三个选项卡处于活动状态(显示)时调用$('。stallion')。live('click',function(),否则该函数中的所有内容都会正确触发, “第三个”选项卡是空的或不是空的,这很难描述,如果你不遵循我的意思,请告诉我,谢谢你的帮助。 – user1028866
它应该是'.tabs(“disable “,2)'而不是'.tabs(”option“,”disabled“,2)' –