From 442fca8eaf3545f9d0a8ed4c5ed385f8f0d11c1e Mon Sep 17 00:00:00 2001 From: luckxu Date: Wed, 3 May 2017 15:55:11 +0800 Subject: [PATCH] Update laydate.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 日期组件在右侧可能超界,显示不全 --- src/lay/modules/laydate.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/lay/modules/laydate.js b/src/lay/modules/laydate.js index 9f07222..3239488 100644 --- a/src/lay/modules/laydate.js +++ b/src/lay/modules/laydate.js @@ -446,7 +446,10 @@ layui.define(function(exports){ //方位辨别 Dates.orien = function(obj, pos){ var tops, rect = Dates.elem.getBoundingClientRect(); - obj.style.left = rect.left + (pos ? 0 : Dates.scroll(1)) + 'px'; + if(rect.left < $(window).width() - 250) + obj.style.left = rect.left + (pos ? 0 : Dates.scroll(1)) + 'px'; + else + obj.style.left = ($(window).width() - 250) + 'px'; if(rect.bottom + obj.offsetHeight/1.5 <= Dates.winarea()){ tops = rect.bottom - 1; } else { @@ -826,4 +829,4 @@ layui.define(function(exports){ exports('laydate', laydate); -}); \ No newline at end of file +});