From 7dd401b2eb805d3799b9c748f5ddc9418a919af8 Mon Sep 17 00:00:00 2001 From: Aleksander Budzinski Date: Tue, 18 Mar 2014 17:19:12 +0100 Subject: [PATCH] Do not scroll over the document top edge With this simple if statement datepicker div will not appear over the document top edge. --- jquery.datetimepicker.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jquery.datetimepicker.js b/jquery.datetimepicker.js index 72d9c02..a2072b4 100644 --- a/jquery.datetimepicker.js +++ b/jquery.datetimepicker.js @@ -988,6 +988,8 @@ 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() ) top = offset.top-datetimepicker[0].offsetHeight+1; + if (top < 0) + top = 0; if( left+datetimepicker[0].offsetWidth>$(window).width() ) left = offset.left-datetimepicker[0].offsetWidth+datetimepicker.data('input')[0].offsetWidth; datetimepicker.css({