0
這是片斷我一起工作 -jQuery的event.target元素的兄弟
$(document).bind('click', function(e) {
if(!$(e.target).is('.element')) {
if ($('.element').hasClass('open')) {
// next line doesn't work
$(this).siblings('ul').slideUp(150);
}
}
});
我想這樣做是得到.element
與該類與其相鄰元素滑動(在這種情況下UL )。我知道爲什麼使用$(this)
在這裏不起作用,但它提供了我想要做的事情的想法。我怎樣才能做到這一點?
請粘貼HTML這裏 – imbondbaby