-5
我试图写一个if/else语句,将隐藏我.thumb
<div>
S中的“约”或在单击“联系人”链接时。我希望所有的.thumb
<div>
都能向上滑动。if/else语句
http://dl.dropbox.com/u/14080718/Final/UITabs15.html
我没有太多的经验,写的if/else statementsI似乎无法找出正确的语法任何帮助,您可以给将不胜感激。
$(function(){
$('.thumb').hide();
$('.subnav').click(function(){
var $menuelement = $('.thumb').eq($(this).closest("li").index());//find the matching nth element in the menu
if($menuelement.hasClass('active')){//if clicked element is already expanded
$menuelement.removeClass('active').slideUp();//remove the active class and hide it
} else {//otherwise,clicked element is not already expanded...
if ($('.active').length>0) {//...but another element is expanded
$('.active').removeClass('active').slideUp(function(){
$menuelement.addClass('active').slideDown();//add the active class and show it
});
} else {//another element is not expanded
$menuelement.addClass('active').slideDown();//add the active class and show it
}
}
});
});
请将您的源代码发布到问题中! – deceze
你可以添加一些你试过的代码吗? – ThinkingStiff
jQuery不是一种语言。 – Ryan