jquery 实现多级下拉菜单
2012-03-07 14:46
573 查看
$(document).ready(function() {
function megaHoverOver(){
$(this).find(".sub").stop().fadeTo('fast', 1).show();
//Calc#bhate width of all #bh's
(function($) {
jQuery.fn.calcSubWidth = function() {
rowWidth = 0;
//Calc#bhate row
$(this).find("ul").each(function() {
rowWidth = $(this).width();
});
};
})(jQuery);
if ( $(this).find(".row").length > 0 ) { //If row exists...
var biggestRow = 0;
//Calculate each row
$(this).find(".row").each(function() {
$(this).calcSubWidth();
//Find biggest row
if(rowWidth > biggestRow) {
biggestRow = rowWidth;
}
});
//Set width
$(this).find(".sub").css({'width' :biggestRow});
$(this).find(".row:last").css({'margin':'0'});
} else { //If row does not exist...
$(this).calcSubWidth();
//Set Width
$(this).find(".sub").css({'width' : rowWidth});
}
}
function megaHoverOut(){
$(this).find(".sub").stop().fadeTo('fast', 0, function() {
$(this).hide();
});
}
var config = {
sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)
interval: 100, // number = milliseconds for onMouseOver polling interval
over: megaHoverOver, // function = onMouseOver callback (REQUIRED)
timeout: 200, // number = milliseconds delay before onMouseOut
out: megaHoverOut // function = onMouseOut callback (REQUIRED)
};
$("#bh-m-xf-menu1topnav li .sub").css({'opacity':'0'});
$("#bh-m-xf-menu1topnav li").hoverIntent(config);
});
function megaHoverOver(){
$(this).find(".sub").stop().fadeTo('fast', 1).show();
//Calc#bhate width of all #bh's
(function($) {
jQuery.fn.calcSubWidth = function() {
rowWidth = 0;
//Calc#bhate row
$(this).find("ul").each(function() {
rowWidth = $(this).width();
});
};
})(jQuery);
if ( $(this).find(".row").length > 0 ) { //If row exists...
var biggestRow = 0;
//Calculate each row
$(this).find(".row").each(function() {
$(this).calcSubWidth();
//Find biggest row
if(rowWidth > biggestRow) {
biggestRow = rowWidth;
}
});
//Set width
$(this).find(".sub").css({'width' :biggestRow});
$(this).find(".row:last").css({'margin':'0'});
} else { //If row does not exist...
$(this).calcSubWidth();
//Set Width
$(this).find(".sub").css({'width' : rowWidth});
}
}
function megaHoverOut(){
$(this).find(".sub").stop().fadeTo('fast', 0, function() {
$(this).hide();
});
}
var config = {
sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)
interval: 100, // number = milliseconds for onMouseOver polling interval
over: megaHoverOver, // function = onMouseOver callback (REQUIRED)
timeout: 200, // number = milliseconds delay before onMouseOut
out: megaHoverOut // function = onMouseOut callback (REQUIRED)
};
$("#bh-m-xf-menu1topnav li .sub").css({'opacity':'0'});
$("#bh-m-xf-menu1topnav li").hoverIntent(config);
});
相关文章推荐
- jQuery实现带动画效果的多级下拉菜单代码
- jQuery实现带动画效果的多级下拉菜单代码
- jQuery实现精美的多级下拉菜单特效
- jQuery实现精美的多级下拉菜单特效
- jQuery实现的多级下拉菜单效果代码
- jQuery实现的多级下拉菜单效果代码
- jquery实现多级下拉菜单的实例代码
- jQuery实现多级手风琴树形下拉菜单(源码)
- jquery实现多级下拉菜单
- jquery实现多级下拉菜单的实例代码
- jQuery简单实现两级下拉菜单效果代码
- jQuery之使用slideToggle实现垂直下拉菜单
- jquery实现鼠标滑过显示二级下拉菜单效果
- jquery+CSS实现的多级竖向展开树形TRee菜单效果
- jQuery实现的fixedMenu下拉菜单效果代码
- 分享我的jquery实现下拉菜单心的
- jQuery实现多级联动下拉列表查询框
- 用Jquery实现多级下拉框无刷新的联动
- jQuery实现非常实用漂亮的select下拉菜单选择效果
- jQuery实现非常实用漂亮的select下拉菜单选择效果