more debugging of scrollIntoView
authorDan Allen <dan@opendevise.com>
Mon, 13 Aug 2018 02:05:36 +0000 (20:05 -0600)
committerDan Allen <dan@opendevise.com>
Mon, 13 Aug 2018 02:05:36 +0000 (20:05 -0600)
src/js/01-navigation.js

index d465c0e..7108706 100644 (file)
 
   function scrollItemIntoView (scrollPosition, parent, el) {
     console.log('scrolling item into view')
-    console.log(el)
+    console.log('stored value: ' + scrollPosition)
     if (!el) return (parent.scrollTop = scrollPosition)
 
     var margin = 10
     var overTheTop = el.offsetTop - scrollPosition < 0
-    var belowTheBottom = el.offsetTop - scrollPosition + el.offsetHeight > parent.offsetHeight
+    var belowTheBottom = (el.offsetTop - scrollPosition + el.offsetHeight) > parent.offsetHeight
 
     if (overTheTop) {
       parent.scrollTop = el.offsetTop - margin