diff --git a/src/modules/layer.js b/src/modules/layer.js index f5007fc2..af139b60 100644 --- a/src/modules/layer.js +++ b/src/modules/layer.js @@ -671,13 +671,15 @@ Class.pt.tips = function(){ }; // 辨别 tips 的方位 + // 21 为箭头大小 8*2 + 箭头相对父元素的top偏移 5 goal.where = [function(){ // 上 goal.autoLeft(); goal.tipTop = goal.top - layArea[1] - 10; tipsG.removeClass('layui-layer-TipsB').addClass('layui-layer-TipsT').css('border-right-color', config.tips[1]); }, function(){ // 右 goal.tipLeft = goal.left + goal.width + 10; - goal.tipTop = goal.top; + goal.tipTop = goal.top - (goal.height * 0.75 < 21 ? 21 - goal.height * 0.5 : 0); + goal.tipTop = Math.max(goal.tipTop, 0); tipsG.removeClass('layui-layer-TipsL').addClass('layui-layer-TipsR').css('border-bottom-color', config.tips[1]); }, function(){ // 下 goal.autoLeft(); @@ -685,7 +687,8 @@ Class.pt.tips = function(){ tipsG.removeClass('layui-layer-TipsT').addClass('layui-layer-TipsB').css('border-right-color', config.tips[1]); }, function(){ // 左 goal.tipLeft = goal.left - layArea[0] - 10; - goal.tipTop = goal.top; + goal.tipTop = goal.top - (goal.height * 0.75 < 21 ? 21 - goal.height * 0.5 : 0); + goal.tipTop = Math.max(goal.tipTop, 0); tipsG.removeClass('layui-layer-TipsR').addClass('layui-layer-TipsL').css('border-bottom-color', config.tips[1]); }]; goal.where[guide-1]();