mirror of https://github.com/layui/layui
优化 layer.tips 在触发元素高度较小时的定位 (#1439)
close https://gitee.com/layui/layui/issues/I8KZ9Apull/1438/head^2
parent
3b781390fe
commit
a03cd0b8da
|
@ -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]();
|
||||
|
|
Loading…
Reference in New Issue