You may use :
$('ul li.next-button').click(fun
ction(even
t) {
event.preventDefault(); // we don't want the click on the anchor change the current page/url
var numberOfSections = $(".foreigndiv").length; // how many section do we have ?
var current = $(".foreigndiv:visible").i
ndex(".for
eigndiv");
// get index of the current visible section
var nextone = (current + 1 >= numberOfSections)?0:(curre
nt + 1); // what is the next one ? If the current is the latest start from the first (section 1)
$(".foreigndiv").eq(curren
t).fadeOut
('fast');
$(".foreigndiv").eq(nexton
e).fadeIn(
'slow');
});
http://api.jquery.com/event.preventDefault/http://api.jquery.com/visible-selector/http://api.jquery.com/index/test page :