Я пытаюсь написать оператор if/else, который будет спрятать мой .thumb
<div>
при каждом щелчке по ссылкам «about» или «contact». Я хочу, чтобы все из .thumb
<div>
s сместились вверх.if/else statement
http://dl.dropbox.com/u/14080718/Final/UITabs15.html
У меня нет большого опыта писать, если/иначе 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