function updateSidebar () {
      var top = (doc && doc.scrollTop) || body.scrollTop
      var headerHeight = header.offsetHeight
      if (top > (headerHeight - 25)) {
        // main.classList.add('fix-sidebar')
        header.classList.add('fix-header')
      } else {
        // main.classList.remove('fix-sidebar')
        header.classList.remove('fix-header')
      }
      if (animating || !allLinks) return
      var last
      for (var i = 0; i < allLinks.length; i++) {
        var link = allLinks[i]
        if (link.offsetTop > top) {
          if (!last) last = link
          break
        } else {
          last = link
        }
      }
      if (last) {
        setActive(last.id)
      }
    }
function updateSidebar () {
      var top = (doc && doc.scrollTop) || body.scrollTop
      var headerHeight = header.offsetHeight
      if (top > (headerHeight - 25)) {
        // main.classList.add('fix-sidebar')
        header.classList.add('fix-header')
      } else {
        // main.classList.remove('fix-sidebar')
        header.classList.remove('fix-header')
      }
      if (animating || !allLinks) return
      var last
      for (var i = 0; i < allLinks.length; i++) {
        var link = allLinks[i]
        if (link.offsetTop > top) {
          if (!last) last = link
          break
        } else {
          last = link
        }
      }
      if (last) {
        setActive(last.id)
      }
    }
function updateSidebar ( ) { var top = ( doc && doc . scrollTop ) || body . scrollTop var headerHeight = header . offsetHeight if ( top > ( headerHeight - 25 ) ) { // main.classList.add('fix-sidebar') header . classList . add ( 'fix-header' ) } else { // main.classList.remove('fix-sidebar') header . classList . remove ( 'fix-header' ) } if ( animating || ! allLinks ) return var last for ( var i = 0 ; i < allLinks . length ; i ++ ) { var link = allLinks [ i ] if ( link . offsetTop > top ) { if ( ! last ) last = link break } else { last = link } } if ( last ) { setActive ( last . id ) } }
// listen for scroll event to do positioning & highlights window.addEventListener('scroll', updateSidebar) window.addEventListener('resize', updateSidebar)
// listen for scroll event to do positioning & highlights window . addEventListener ( scroll updateSidebar ) window . addEventListener ( resize updateSidebar )
Update sidebar