("ul.topnav li")
がホバーされていて、<span>
が表示されていないときにメニューがドロップするように、このコードを変更するにはどうすればよいですか?私がコードを変更したときには、("ul.subnav)
が上に乗ったときに全てが落ちました。jqueryドロップダウンメニュー
おかげで、あなたはli
から.mouseenter()
イベントの添付ファイルを変更すると
<script language="javascript" type="text/javascript">
$(document).ready(function() {
$("ul.subnav").parent().append("<span></span>");
//When trigger is clicked...
$("ul.topnav li span").mouseenter(function() {
//Following events are applied to the subnav itself
//(moving subnav up and down)
//Drop down the subnav on click
$(this).parent().find("ul.subnav").slideDown('fast').show();
$(this).parent().hover(function() {
}, function() {
//When the mouse hovers out of the subnav, move it back up
$(this).parent().find("ul.subnav").slideUp('slow');
});
//Following events are applied to the trigger
}).hover(function() { //(Hover events for the trigger)
$(this).addClass("subhover"); //On hover over, add class "subhover"
}, function() { //On Hover Out
//On hover out, remove class "subhover"
$(this).removeClass("subhover");
});
});
</script>
私は(あなたがthis.slidetoggleを下にスライドさせるサブたNAVのすべてをスライドさULのNAVの親を選択していると思います) –