Avoids jumping if window is smaller than 300 pixels in height

* divides the area where the scroll should be triggered by 2
* uses the minimum value of the above and 300
This commit is contained in:
Morris Jobke 2016-02-23 10:47:38 +01:00
parent e03a09d189
commit 5711e88093
No known key found for this signature in database
GPG key ID: 9CE5ED29E7FCD38A

View file

@ -402,9 +402,10 @@ var dragOptions={
},
drag: function(event, ui) {
var currentScrollTop = $("#app-content").scrollTop();
var scrollArea = Math.min(Math.floor($(window).innerHeight()/2), 300);
var bottom = $(window).innerHeight() - 300;
var top = $(window).scrollTop() + 300;
var bottom = $(window).innerHeight() - scrollArea;
var top = $(window).scrollTop() + scrollArea;
if (event.pageY < top){
$('html, body').animate({
scrollTop: $("#app-content").scrollTop(currentScrollTop-=10)