I'm trying to create a clickable sub-menu with slideDown()
via jQuery. However - hover()
is working as intended, but click()
doesn't do anything.
Here's my jQuery:
$("#n_ulist li").click(function(){
$("ul", this).stop().slideDown(500);
},
function() {
$("ul", this).stop().slideUp(500);
});
What is wrong here?
try the following instead:
$("#n_ulist li").click(function(){
$(this).parent().find('ul').stop().slideUp(500);
$("ul", this).stop().slideDown(500);
});
or if your menu is more than one level you may need to use
$('#n_ulist').find('ul').stop().slideUp(500);
EDIT
As per your comments
$("#n_ulist li").click(function(){
$(this).parent().find('ul').stop().slideUp(500);
$("ul", this).stop().slideToggle(500).click(function(e) {
e.stopPropagation();
});
});
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다