我製作了Tabs。每個選項卡包含一個div。我想要使用if else條件將div內容從左向右滑動。但我用警報框進行了檢查。但它沒有奏效。這是我的代碼。用jquery html div滑動div內容
$('.tabs').click(function() {
if ('.tabs :nth-child(even)')
{
alert("11111");
$('.tab-content').hide("slide", {
direction: "left"
}, 1000);
alert("222222");
$('.tab-content').show("slide", {
direction: "left"
}, 1000);
alert("3333333");}
else
{
$('.tab-content').hide("slide", {
direction: "right"
}, 1000);
alert("777777");
$('.tab-content').show("slide", {
direction: "right"
}, 1000);
alert("6666666");
}
});
我finxed問題。請在下面看到我的回答 –