.on
関数には 3 つのパラメーターしかありません: http://api.jquery.com/on/
ハンドラーを動的に追加された要素にもバインドする必要がない場合は、hover
2 つのイベント ハンドラーで古き良き関数を使用できます。
$('.top-level').hover(function (event) {
$(this).find('.actionfcnt').show();
$(this).find('.dropfcnt').show();
}, function (event) {
$(this).find('.dropfcnt').hide('blind', function(){
$('.actionfcnt').hide();
});
});
ちなみに$(selector).hover(handlerIn, handlerOut)
は の略です$(selector).mouseenter(handlerIn).mouseleave(handlerOut);
。
必要に応じて、on
formouseenter
とmouseleave
eventsを使用します。
$(document).on('mouseenter', '.top-level', function (event) {
$(this).find('.actionfcnt').show();
$(this).find('.dropfcnt').show();
}).on('mouseleave', '.top-level', function (event) {
$(this).find('.dropfcnt').hide('blind', function(){
$('.actionfcnt').hide();
});
});