By some looking, I found that the current section
has the class present
. So, you can get the current section's id by using the below code.
$('.navigate-left').click(function () {
var currentSection = $('section.present');
var prevId = currentSection.prev('section').attr('id');
var nextId = currentSection.next('section').attr('id');
$(this).text(prevId);
$('.navigate-right').text(nextId);
});
$('.navigate-right').click(function () {
var currentSection = $('section.present');
var prevId = currentSection.prev('section').attr('id');
var nextId = currentSection.next('section').attr('id');
$('.navigate-left').text(prevId);
$(this).text(nextId);
});
EDIT: The below demo gives you the ids of the previous & next sections below the arrows