Guest User

Untitled

a guest
Jun 22nd, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. $('a').click(function(event){
  2. event.preventDefault();
  3. if ( $(this).is('.next') ){ //simple class name instead of id
  4. $vis = $(this).parent().find('p:visible'); // find visible p
  5. if ($vis.next().length) // see if there is a next
  6. $vis.hide().next().show(); // hide current show next
  7. else $vis.hide().parent().find(':first').show(); // or cycle to top
  8. else{ // must be .prev if no other links on page
  9. $vis = $(this).parent().find('p:visible'); // find visible p
  10. if ($vis.prev().length) // see if there is a next
  11. $vis.hide().prev().show(); // hide current show previous
  12. else $vis.hide().parent().find(':last').show(); // or cycle to bottom
  13.  
  14. }
  15. });
Add Comment
Please, Sign In to add comment