From c3181ceb09aa1ded8dcfd11d16252e3057c6f9ed Mon Sep 17 00:00:00 2001 From: illuminati-fin Date: Thu, 28 May 2015 23:25:12 +0300 Subject: [PATCH] Fixed parent positioning bug --- jquery.datetimepicker.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/jquery.datetimepicker.js b/jquery.datetimepicker.js index e1b00ce..377df74 100644 --- a/jquery.datetimepicker.js +++ b/jquery.datetimepicker.js @@ -1788,6 +1788,14 @@ left = $(window).width() - datetimepicker[0].offsetWidth; } } + var node = datetimepicker[0] + do { + node = node.parentNode; + if(window.getComputedStyle(node).getPropertyValue('position') === 'relative' && $(window).width() >= node.offsetWidth) { + left = left - (($(window).width() - node.offsetWidth)/2) + break + } + } while(node.nodeName != 'HTML') datetimepicker.css({ left: left, top: top,