메뉴 클래스 ul 클래스는 li 클래스를 가리키면 드롭 내용을 열도록 전체 너비를 늘립니다. 마우스가 여전히 "ul"에있을 때 마지막 li의 열린 내용을 계속 열어두고, 마우스가 메뉴에서 완전히 벗어날 때만 내용을 숨기고 싶습니다. jsFiddle 설정, 파란색 bg 필드는 마우스가 아직있을 때 마지막 내용을 열어두고 싶습니다. li 클래스에서 마우스를 가져 가면 jquery 드롭 다운 메뉴가 열린 상태로 유지하는 방법
http://jsfiddle.net/R7aTq/150/
(function($){
$.fn.naviDropDown = function(options) {
//set up default options
var defaults = {
dropDownClass: 'dropdown', //the class name for your drop down
dropDownWidth: 'auto', //the default width of drop down elements
slideDownEasing: 'easeInOutCirc', //easing method for slideDown
slideUpEasing: 'easeInOutCirc', //easing method for slideUp
slideDownDuration: 500, //easing duration for slideDown
slideUpDuration: 500, //easing duration for slideUp
orientation: 'horizontal' //orientation - either 'horizontal' or 'vertical'
};
var opts = $.extend({}, defaults, options);
return this.each(function() {
var $this = $(this);
$this.find('.'+opts.dropDownClass).css('width', opts.dropDownWidth).css('display', 'none');
var buttonWidth = $this.find('.'+opts.dropDownClass).parent().width() + 'px';
var buttonHeight = $this.find('.'+opts.dropDownClass).parent().height() + 'px';
if(opts.orientation == 'horizontal') {
$this.find('.'+opts.dropDownClass).css('left', '0px').css('top', buttonHeight);
}
if(opts.orientation == 'vertical') {
$this.find('.'+opts.dropDownClass).css('left', buttonWidth).css('top', '0px');
}
$this.find('li').hoverIntent(getDropDown, hideDropDown);
});
function getDropDown(){
activeNav = $(this);
showDropDown();
}
function showDropDown(){
activeNav.find('.'+opts.dropDownClass).slideDown({duration:opts.slideDownDuration, easing:opts.slideDownEasing});
}
function hideDropDown(){
activeNav.find('.'+opts.dropDownClass).slideUp({duration:opts.slideUpDuration, easing:opts.slideUpEasing});//hides the current dropdown
}
};
})(jQuery);
할 수는 있지만 사소한 것이 아니며 그러한 현지화 된 상황에 대한 도움말 포럼에서 발생할 가능성은 거의 없습니다. hoverintent를 제거하고 개별 마우스 이벤트 및 타이머를 다시 작성하고 브라우저 간 호환이 가능하도록해야합니다. 누군가에게 시달림을 주겠다고 – charlietfl