title: Getting second last visible li
body: <p>I have a navigation bar. Each li can have a flyout and the li's in those flyouts can also have flyouts. I am trying to dynamically limit only 10 to be shown at a time and have a previous and next button.</p>
  
  <pre><code>$("#nextButton").live('click', function()
  {
      // Get li's in navbar and the size of them
      var list = $(this).siblings();
      var listLength = $(list).length - 1; // -1 because of nav button (siblings doesn't include this)
  
  
      // remove hidden elements from list
      $(list).each(function()
      {   var increment = 0;
          increment++;
          if($(this).css("display") == "none")
          {
              list.splice(increment, 1);
          }
      });
  
      var p = $(list).selector+':nth-last-child(2)'.index(); // I would like get the second last element (this line does not work)
      //below commented out does not work
      //var item = $(list).last().prev().index();
      // Dynamically check if can navigate 10 items back
      var postionIfNext = ($(list).index() + 9); // 9 bcus we manually add the prev btn which = 10
      if(postionIfNext &lt;= listLength)
      {
          $(this).siblings().hide().slice((postionIfNext - 10), postionIfNext).show();
          $(this).siblings().slice(0,1).show(); // show prev btn
      }       
      });
  </code></pre>