我正在製作手風琴效果,使用切換來展開和收縮div的高度。.toggle()所有高度超過99px的div
當用戶切換一個div時,它會展開高度,我希望前一個切換回來。 因此,我需要選擇所有的兄弟姐妹,但我只想定位已擴展的div,以便再次縮小它的高度。
我想選擇擴展的div使用條件,如果高度超過99像素的功能,我認爲這是最好的方式來選擇只擴展的div。
我哪裏錯了?
我的代碼。
$(function() {
jQuery.fn.selectOpen = (function(){
//(this).css('background-color', 'red');
if ($(this).height() > 99) {
$(this).trigger(".toggle");
}
});
});
$("#arrow_01").toggle(function(){
$("#arrow_01").attr('src','images/arrow_down.png');
$("#expanding_box_01").animate({height: '100px', }).siblings().selectOpen();
}, function(){
$('#arrow_01').attr('src','images/arrow_right.png');
$("#expanding_box_01").animate({height: '27px' });
});