Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $('a').click(function(event){
- event.preventDefault();
- if ( $(this).is('.next') ){ //simple class name instead of id
- $vis = $(this).parent().find('p:visible'); // find visible p
- if ($vis.next().length) // see if there is a next
- $vis.hide().next().show(); // hide current show next
- else $vis.hide().parent().find(':first').show(); // or cycle to top
- else{ // must be .prev if no other links on page
- $vis = $(this).parent().find('p:visible'); // find visible p
- if ($vis.prev().length) // see if there is a next
- $vis.hide().prev().show(); // hide current show previous
- else $vis.hide().parent().find(':last').show(); // or cycle to bottom
- }
- });
Add Comment
Please, Sign In to add comment