I'm having quite a trouble getting it done, so I thought I could ask for some help.
What I'm trying to do is to have the top menu (gkMenuWrap) being changed to class "active" after scrolling down a specific pixel size (for example 100px).
Right now, the code is meant to set class=active on gkMenuWrap, after the page scroll size is bigger than the header size, which is something I don't prefer.
Below is the code which I believe needs to be edited
- Code: Select all
// menu animation
if(page_loaded && document.getElement('body').hasClass('imageBg')) {
// if menu is not displayed now
if(window.getScroll().y > document.id('gkHeader').getSize().y && !document.id('gkMenuWrap').hasClass('active')) {
document.id('gkHeaderNav').inject(document.id('gkMenuWrap'), 'inside');
document.id('gkHeader').setProperty('class', 'gkNoMenu');
document.id('gkHeader').getElement('div').setStyle('display', 'none');
document.id('gkMenuWrap').setProperty('class', 'active');
}
//
if(window.getScroll().y <= document.id('gkHeader').getSize().y && document.id('gkMenuWrap').hasClass('active')) {
document.id('gkHeader').getElement('div').setStyle('display', 'block');
document.id('gkHeaderNav').inject(document.id('gkHeader').getElement('div'), 'top');
document.id('gkHeader').setProperty('class', '');
document.id('gkMenuWrap').setProperty('class', '');
}
}
Thanks in advance