|
|
|
@ -499,44 +499,44 @@ layui.define('jquery', function(exports){
|
|
|
|
|
var itemElem = othis.find('.'+NAV_ITEM); |
|
|
|
|
|
|
|
|
|
// hover 滑动效果
|
|
|
|
|
if (!othis.find('.'+NAV_BAR)[0]) { |
|
|
|
|
othis.append(bar); |
|
|
|
|
( othis.hasClass(NAV_TREE) |
|
|
|
|
? itemElem.find('dd,>.'+ NAV_TITLE)
|
|
|
|
|
: itemElem |
|
|
|
|
).on('mouseenter', function() { |
|
|
|
|
follow.call(this, bar, othis, index); |
|
|
|
|
}).on('mouseleave', function() { // 鼠标移出
|
|
|
|
|
// 是否为垂直导航
|
|
|
|
|
if (othis.hasClass(NAV_TREE)) { |
|
|
|
|
var hasBarElem = othis.find('.'+NAV_BAR)[0]; |
|
|
|
|
if (hasBarElem) hasBarElem.remove(); |
|
|
|
|
othis.append(bar); |
|
|
|
|
( othis.hasClass(NAV_TREE) |
|
|
|
|
? itemElem.find('dd,>.'+ NAV_TITLE)
|
|
|
|
|
: itemElem |
|
|
|
|
).off('mouseenter.lay_nav').on('mouseenter.lay_nav', function() { |
|
|
|
|
follow.call(this, bar, othis, index); |
|
|
|
|
}).off('mouseleave.lay_nav').on('mouseleave.lay_nav', function() { // 鼠标移出
|
|
|
|
|
// 是否为垂直导航
|
|
|
|
|
if (othis.hasClass(NAV_TREE)) { |
|
|
|
|
bar.css({ |
|
|
|
|
height: 0, |
|
|
|
|
opacity: 0 |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
// 隐藏子菜单
|
|
|
|
|
clearTimeout(timerMore[index]); |
|
|
|
|
timerMore[index] = setTimeout(function(){ |
|
|
|
|
othis.find('.'+ NAV_CHILD).removeClass(SHOW); |
|
|
|
|
othis.find('.'+ NAV_MORE).removeClass(NAV_MORE +'d'); |
|
|
|
|
}, 300); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// 鼠标离开当前菜单时
|
|
|
|
|
othis.off('mouseleave.lay_nav').on('mouseleave.lay_nav', function() { |
|
|
|
|
clearTimeout(timer[index]) |
|
|
|
|
timeEnd[index] = setTimeout(function() { |
|
|
|
|
if (!othis.hasClass(NAV_TREE)) { |
|
|
|
|
bar.css({ |
|
|
|
|
height: 0, |
|
|
|
|
width: 0, |
|
|
|
|
left: bar.position().left + bar.width() / 2, |
|
|
|
|
opacity: 0 |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
// 隐藏子菜单
|
|
|
|
|
clearTimeout(timerMore[index]); |
|
|
|
|
timerMore[index] = setTimeout(function(){ |
|
|
|
|
othis.find('.'+ NAV_CHILD).removeClass(SHOW); |
|
|
|
|
othis.find('.'+ NAV_MORE).removeClass(NAV_MORE +'d'); |
|
|
|
|
}, 300); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// 鼠标离开当前菜单时
|
|
|
|
|
othis.on('mouseleave', function() { |
|
|
|
|
clearTimeout(timer[index]) |
|
|
|
|
timeEnd[index] = setTimeout(function() { |
|
|
|
|
if (!othis.hasClass(NAV_TREE)) { |
|
|
|
|
bar.css({ |
|
|
|
|
width: 0, |
|
|
|
|
left: bar.position().left + bar.width() / 2, |
|
|
|
|
opacity: 0 |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}, TIME); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}, TIME); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// 展开子菜单
|
|
|
|
|
itemElem.find('a').each(function() { |
|
|
|
|