Download & Extend

how can I add a class to the previously active pager li?

Project:Views cycle
Version:6.x-1.0
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

I know this has to be simple but I'm an amateur when it comes to jquery and javascript. I want to add a class to the pager list item that is rendered just before the active list item, so for example:

<ul class="views-cycle-pager">
  <li>list item 1</li>
  <li class="activeSlide>list item 2</li>
  <li>list item 3</li>
  <li>list item 4</li>
</ul>

If list item 2 is active, I want to add a class to the previous item, list item 1.

Here's the function in views_cycle.js where it would be added:

function updateActivePager(pager, currSlideIndex) {
      $(pager)
        .find('li').removeClass('activeSlide')
        .filter('li:eq(' + currSlideIndex + ')').addClass('activeSlide');
}

So how could I reference the previous li with filter('li:eq')?

Thanks for any insight.

nobody click here