-2

如何将其组合成 1 个脚本?

$('#tabs, #tabs-1').tabs({
    select: function(event, ui){
    $("#picture").hide();
    }
});

$('#tabs, #tabs-2').tabs({
    select: function(event, ui){
    $("#picture").hide();
    }
});

$('#tabs, #tabs-3').tabs({
    select: function(event, ui){
    $("#picture").hide();
    }
});

$('#tabs, #tabs-4').tabs({
    select: function(event, ui){
    $("#picture").show();
     }
});
4

1 回答 1

0

Try this:

Hope it fits the cause :)

Code

$('#tabs, #tabs-1,  #tabs-2, #tabs-3, #tab-4').click(function() {
   var num = $(this).attr('class');

  //get the number at the end of the class of this particular div           
   var lastChar = num.substr(num.length - 1)

  select: function(event, ui){
       if(lastChar == "4")
         $("#picture").show();
       else
        $("#picture").hide();
   }

  });
于 2012-11-10T07:38:08.477 回答