优化菜单下拉效果
parent
5935c020f9
commit
8cff7d490a
|
|
@ -429,33 +429,26 @@ layui.define(['table', 'jquery', 'element'], function(exports) {
|
||||||
|
|
||||||
function downShow(option) {
|
function downShow(option) {
|
||||||
$("body #" + option.elem).on("click", "a[menu-type='0']", function() {
|
$("body #" + option.elem).on("click", "a[menu-type='0']", function() {
|
||||||
|
|
||||||
if (!$("#" + option.elem).is(".pear-nav-mini")) {
|
if (!$("#" + option.elem).is(".pear-nav-mini")) {
|
||||||
|
|
||||||
var superEle = $(this).parent();
|
var superEle = $(this).parent();
|
||||||
var ele = $(this).next('.layui-nav-child');
|
var ele = $(this).next('.layui-nav-child');
|
||||||
var height = ele.height();
|
var heights = ele.children("dd").length * 40;
|
||||||
if ($(this).parent().is(".layui-nav-itemed")) {
|
|
||||||
|
|
||||||
|
if ($(this).parent().is(".layui-nav-itemed")) {
|
||||||
if (option.accordion) {
|
if (option.accordion) {
|
||||||
$(this).parent().parent().find(".layui-nav-itemed").removeClass("layui-nav-itemed");
|
$(this).parent().parent().find(".layui-nav-itemed").removeClass("layui-nav-itemed");
|
||||||
$(this).parent().addClass("layui-nav-itemed");
|
$(this).parent().addClass("layui-nav-itemed");
|
||||||
}
|
}
|
||||||
|
|
||||||
ele.height(0);
|
ele.height(0);
|
||||||
|
|
||||||
ele.animate({
|
ele.animate({
|
||||||
height: height + "px"
|
height: heights + "px"
|
||||||
}, 200, function() {
|
}, 200, function() {
|
||||||
ele.css({
|
ele.css({
|
||||||
height: "auto"
|
height: "auto"
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$(this).parent().addClass("layui-nav-itemed");
|
$(this).parent().addClass("layui-nav-itemed");
|
||||||
|
|
||||||
ele.animate({
|
ele.animate({
|
||||||
height: "0px"
|
height: "0px"
|
||||||
}, 200, function() {
|
}, 200, function() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue