Я пытаюсь добавить класс в липкое меню при прокрутке, используя полную страницу .js.
Я бы хотел, чтобы # top-wrapper был нормальным при загрузке первого раздела / страницы, а затем, когда вы прокручиваете вниз, он добавляет класс is-fixed. Если вы вернетесь к первому разделу, класс будет удален.
В настоящее время происходит то, что по мере того, как пользователь прокручивает страницу вниз, добавляется класс is-fixed (что правильно). Однако, если вы вернетесь к первому разделу, класс не будет удален.
Вот мой код:
var fullPageInstance = new fullpage('#page-wrapper', {
anchors: ['firstPage', 'secondPage', '3rdPage', '4thpage', '5thpage', '6thpage'],
menu: '#side-menu',
slidesNavigation: true,
scrollingSpeed: 1000,
parallax: true,
parallaxOptions: {
type: 'cover',
percentage: 62,
property: 'translate'
},
onLeave: function(index, nextIndex, direction){
if (nextIndex != 1){
$('#top-wrapper').addClass('is-fixed');
} else {
$('#top-wrapper').removeClass('is-fixed');
}
}
});