1. Adrian Sampson
  2. alwaysreading2

Commits

Adrian Sampson  committed 68ae8ba

fix jumpy scrolling

  • Participants
  • Parent commits be99da2
  • Branches default

Comments (0)

Files changed (1)

File static/ar2.js

View file
     
     didSelect: function(view) {
         // Scroll the selected item into view.
-        var itemTop = $(view.el).position().top;
-        var itemBottom = itemTop + $(view.el).outerHeight();
-        var windowTop = this.el.scrollTop();
-        var windowBottom = windowTop + this.el.innerHeight();
-        if (itemTop < windowTop || itemBottom > windowBottom) {
+        var top = $(view.el).position().top;
+        var bottom = top + $(view.el).outerHeight();
+        var viewHeight = this.el.innerHeight();
+        if (top < 0 || bottom > viewHeight) {
             $(view.el).each(function() {
                 if (this.scrollIntoView) {
                     this.scrollIntoView();