From c09166efe2231b62615e2ca12249711c4ec998a7 Mon Sep 17 00:00:00 2001 From: ansuz Date: Mon, 25 Jul 2016 15:42:46 +0200 Subject: [PATCH] scroll down when adding a new option to the table --- www/poll/main.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/www/poll/main.js b/www/poll/main.js index 3e962a726..57eade939 100644 --- a/www/poll/main.js +++ b/www/poll/main.js @@ -179,6 +179,16 @@ define([ return $user; }; + var scrollDown = module.scrollDown = function (px) { + var top = $(window).scrollTop() + px + 'px'; + $('html, body').animate({ + scrollTop: top, + }, { + duration: 200, + easing: 'swing', + }); + }; + var makeOption = function (proxy, id, value) { var $option = Input({ type: 'text', @@ -202,6 +212,7 @@ define([ addIfAbsent(proxy.table.rowsOrder, id); var $row = table.addRow($wrapper, Checkbox, id); + scrollDown($row.height()); return $option; };