From ebc099e1ff9e35cf080f9f97cb4afb8b70d0c539 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B1=E7=9C=A0=E4=BB=AA=E5=BC=8F?= <854085467@qq.com> Date: Mon, 24 Aug 2020 17:02:00 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8F=9C=E5=8D=95=E9=81=AE=E7=9B=96=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- component/pear/module/menu.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/component/pear/module/menu.js b/component/pear/module/menu.js index a20d3a8..97f0801 100644 --- a/component/pear/module/menu.js +++ b/component/pear/module/menu.js @@ -361,7 +361,19 @@ layui.define(['table', 'jquery', 'element'], function(exports) { if (b) { $("#" + option.elem + ".pear-nav-mini .layui-nav-item,#" + option.elem + ".pear-nav-mini dd").hover(function() { $(this).children(".layui-nav-child").addClass("layui-nav-hover"); + var top = $(this).offset().top + 5; + var y = window.document.body.clientHeight; + + var height = $(window).height(); + + var topLength = $(this).offset().top; + + var thisHeight = $(this).children(".layui-nav-child").height(); + + if((thisHeight+topLength)>height){ + topLength = height-thisHeight-10; + } if (!$(this).is(".layui-nav-item")) { var left = $(this).offset().left + 132; $(this).children(".layui-nav-child").offset({ @@ -374,7 +386,7 @@ layui.define(['table', 'jquery', 'element'], function(exports) { }); } $(this).children(".layui-nav-child").offset({ - top: top + top: topLength }); }, function() { $(this).children(".layui-nav-child").removeClass("layui-nav-hover");