mirror of https://github.com/layui/layui
fix(element-nav): 动态添加元素渲染异常 (#2276)
parent
c781567a68
commit
a1491c1936
|
@ -499,14 +499,15 @@ layui.define('jquery', function(exports){
|
||||||
var itemElem = othis.find('.'+NAV_ITEM);
|
var itemElem = othis.find('.'+NAV_ITEM);
|
||||||
|
|
||||||
// hover 滑动效果
|
// hover 滑动效果
|
||||||
if (!othis.find('.'+NAV_BAR)[0]) {
|
var hasBarElem = othis.find('.'+NAV_BAR)[0];
|
||||||
|
if (hasBarElem) hasBarElem.remove();
|
||||||
othis.append(bar);
|
othis.append(bar);
|
||||||
( othis.hasClass(NAV_TREE)
|
( othis.hasClass(NAV_TREE)
|
||||||
? itemElem.find('dd,>.'+ NAV_TITLE)
|
? itemElem.find('dd,>.'+ NAV_TITLE)
|
||||||
: itemElem
|
: itemElem
|
||||||
).on('mouseenter', function() {
|
).off('mouseenter.lay_nav').on('mouseenter.lay_nav', function() {
|
||||||
follow.call(this, bar, othis, index);
|
follow.call(this, bar, othis, index);
|
||||||
}).on('mouseleave', function() { // 鼠标移出
|
}).off('mouseleave.lay_nav').on('mouseleave.lay_nav', function() { // 鼠标移出
|
||||||
// 是否为垂直导航
|
// 是否为垂直导航
|
||||||
if (othis.hasClass(NAV_TREE)) {
|
if (othis.hasClass(NAV_TREE)) {
|
||||||
bar.css({
|
bar.css({
|
||||||
|
@ -524,7 +525,7 @@ layui.define('jquery', function(exports){
|
||||||
});
|
});
|
||||||
|
|
||||||
// 鼠标离开当前菜单时
|
// 鼠标离开当前菜单时
|
||||||
othis.on('mouseleave', function() {
|
othis.off('mouseleave.lay_nav').on('mouseleave.lay_nav', function() {
|
||||||
clearTimeout(timer[index])
|
clearTimeout(timer[index])
|
||||||
timeEnd[index] = setTimeout(function() {
|
timeEnd[index] = setTimeout(function() {
|
||||||
if (!othis.hasClass(NAV_TREE)) {
|
if (!othis.hasClass(NAV_TREE)) {
|
||||||
|
@ -536,7 +537,6 @@ layui.define('jquery', function(exports){
|
||||||
}
|
}
|
||||||
}, TIME);
|
}, TIME);
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
// 展开子菜单
|
// 展开子菜单
|
||||||
itemElem.find('a').each(function() {
|
itemElem.find('a').each(function() {
|
||||||
|
|
Loading…
Reference in New Issue