Is there any way to get last viewed section index/id/class when moving to next or previous section using scrollify.js?
Am looking for any predefined function like scrollify.current() for getting last viewed section.
Thanks in advance
Is there any way to get last viewed section index/id/class when moving to next or previous section using scrollify.js?
Am looking for any predefined function like scrollify.current() for getting last viewed section.
Thanks in advance
Not able to find any predefined class, so wrote my own function.
var prevIndex = 0;
$.scrollify({
before:function(index, sections) {
var prevSection = '#' + getScrollifySectionID(prevIndex)
prevIndex = index;
//Do your code with PrevSection(ID).
}
});
function getScrollifySectionID(index){
var sectionID = '';
$('.scrollify-section').each(function(i){
if(i == index){
sectionID = $(this).data('section');
}
});
return sectionID;
};