           return getNextMenuItem()
 
         else
+          if contentHeaders.length == 0
+            currentMenuItem =
+              index: 0
+            return getNextMenuItem()
+
           currentMenuItem =
             index: 0,
             url: "#" + $(contentHeaders[0]).attr("id")
+
+
 
       else if currentMenuItem.index + 1 >= contentHeaders.length
         next = $(".js-next-page")


$ ->
  currentMenuItem = null
  if anchors
    anchors.options =
      placement: 'right',
      icon: '#'
    anchors.add('.markdown-body h3, .markdown-body h4, .markdown-body h5, .markdown-body h6')

  $(document).on "click", ".js-nav-item", (e) ->
    e.preventDefault()
    $("body").toggleClass("is-nav-close is-nav-open")

  $(document).on "keypress", (e) ->
    contentHeaders = $('.markdown-body h3, .markdown-body h4, .markdown-body h5, .markdown-body h6');
    pushHash = (item) ->
      if item
        window.location = item.url


        else
          currentMenuItem =
            index: 0
          return getPrevMenuItem()
      else if currentMenuItem.index <= 0
        prev = $(".js-last-page")

