]> git.wh0rd.org Git - tt-rss.git/commitdiff
cdmScrollToArticleId: use more natural scrolling
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Wed, 27 Feb 2013 14:44:45 +0000 (18:44 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Wed, 27 Feb 2013 14:44:45 +0000 (18:44 +0400)
js/viewfeed.js

index 2f1ba24e010572b860c7d82871d4975c3bdb2659..07af91a674ab30073ac3ed38d084db6075785215 100644 (file)
@@ -1132,7 +1132,11 @@ function cdmScrollToArticleId(id) {
 
                if (!e || !ctr) return;
 
-               ctr.scrollTop = e.offsetTop;
+               if (e.offsetTop+e.offsetHeight > (ctr.scrollTop+ctr.offsetHeight) ||
+                               e.offsetTop < ctr.scrollTop) {
+
+                       ctr.scrollTop = e.offsetTop;
+               }
 
        } catch (e) {
                exception_error("cdmScrollToArticleId", e);