From a89d8c00050b2d323e84eb0ee4da0f2a76fe0b62 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Wed, 10 Jul 2013 22:33:23 -0400 Subject: [PATCH] Minor cleanup --- assets/js/app.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/assets/js/app.js b/assets/js/app.js index d48e53d..b1c4b9c 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -275,14 +275,18 @@ if (item) switch_status(item.getAttribute("data-item-id")); } - function scroll_page_to(item) { + + function scroll_page_to(item) + { var clientHeight = pageYOffset + document.documentElement.clientHeight; var itemPosition = item.offsetTop + item.offsetHeight; + if (clientHeight - itemPosition < 0 || clientHeight - item.offsetTop > document.documentElement.clientHeight) { - scrollTo(0, item.offsetTop - 10); + window.scrollTo(0, item.offsetTop - 10); } } + function set_links_item(item_id) { var link = document.getElementById("current-item");