Merge pull request #77 from Olek89/fix/position-above-the-page-top

Do not scroll over the document top edge
This commit is contained in:
Valeriy 2014-03-18 23:07:59 +06:00
commit 9dc632f504

View File

@ -988,6 +988,8 @@
var offset = datetimepicker.data('input').offset(), top = offset.top+datetimepicker.data('input')[0].offsetHeight-1, left = offset.left; var offset = datetimepicker.data('input').offset(), top = offset.top+datetimepicker.data('input')[0].offsetHeight-1, left = offset.left;
if( top+datetimepicker[0].offsetHeight>$(window).height()+$(window).scrollTop() ) if( top+datetimepicker[0].offsetHeight>$(window).height()+$(window).scrollTop() )
top = offset.top-datetimepicker[0].offsetHeight+1; top = offset.top-datetimepicker[0].offsetHeight+1;
if (top < 0)
top = 0;
if( left+datetimepicker[0].offsetWidth>$(window).width() ) if( left+datetimepicker[0].offsetWidth>$(window).width() )
left = offset.left-datetimepicker[0].offsetWidth+datetimepicker.data('input')[0].offsetWidth; left = offset.left-datetimepicker[0].offsetWidth+datetimepicker.data('input')[0].offsetWidth;
datetimepicker.css({ datetimepicker.css({