if ($('li:last').is(':visible')) { //go back to first element }

if ($('li:last').is(':visible')) { //go back to first element }


I'm working on a banner 'slider' with a next, and previous button.
There are 3 li elements i'm targetting.

In plain english, this is what i'm trying to achieve -
"if the last li element is displayed, (visible) - then hide it, and display the first element.."

  1. if ($('li:last').is(':visible')) {
  2. // code to execute
  3. }
Any help / suggestions well appreciated!