Change scroll size setting of gkMenuWrap
Rate this topic: 1.00 out of 6 based on 1 vote(s)
- GK User
- Sun Jun 23, 2013 9:49 pm
- Reply with quote
- Report this post
Hi,
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
Thanks in advance
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
-
- Fresh Boarder
- GK User
- Mon Jun 24, 2013 8:47 am
- Reply with quote
- Report this post
Its exactly this line:
And You need to change it to:
to show the menu when user scrolls more than 100px from the top.
- Code: Select all
if(window.getScroll().y > document.id('gkHeader').getSize().y && !document.id('gkMenuWrap').hasClass('active')) {
And You need to change it to:
- Code: Select all
if(window.getScroll().y > 100 && !document.id('gkMenuWrap').hasClass('active')) {
to show the menu when user scrolls more than 100px from the top.
-
- Moderator
- GK User
- Mon Jun 24, 2013 8:58 am
- Reply with quote
- Report this post
Thanks a lot, I was typing "100px" and it gave me errors...
-
- Fresh Boarder
- GK User
- Mon Jun 24, 2013 9:22 am
- Reply with quote
- Report this post
JS likes to have dimensions in numbers.
If You would need to set css via JS (for example with jQuery .css method) - then You would need to add 'px' after the number.
If You would need to set css via JS (for example with jQuery .css method) - then You would need to add 'px' after the number.
-
- Moderator
- GK User
- Tue Mar 17, 2015 10:44 am
- Reply with quote
- Report this post
I think I need to alter something in gk.menu.js too, but I don't know what.
I would like to have the same mainmenu as the frontpage on every page. So no white background when its over the header. When scrolled down, I would like to have the white background, just like it is on the frontpage.
I would like to have the same mainmenu as the frontpage on every page. So no white background when its over the header. When scrolled down, I would like to have the white background, just like it is on the frontpage.
-
- Gold Boarder
- GK User
- Wed Mar 18, 2015 2:46 pm
- Reply with quote
- Report this post
Could you please post an url to your site?
-
- Moderator
- GK User
- Thu Mar 19, 2015 9:04 am
- Reply with quote
- Report this post
The URL is http://6gt.nl/
-
- Gold Boarder
- GK User
- Fri Mar 20, 2015 11:01 am
- Reply with quote
- Report this post
This is what I would like to do:
-
- Gold Boarder
- GK User
- Fri Mar 20, 2015 12:21 pm
- Reply with quote
- Report this post
Please check if adding "imageBg" page suffix to your other "heather" pages helps.
-
- Moderator
- GK User
- Fri Mar 20, 2015 1:54 pm
- Reply with quote
- Report this post
I already have backgrounds for each page, so that wasn't a problem. I just want to remove the white background of the menu on the header of those pages.
-
- Gold Boarder
- GK User
- Sun Mar 22, 2015 11:23 am
- Reply with quote
- Report this post
From what I see currently you have added:
"imageBgVoordelen"
as a page suffix, but it should be:
"imageBg Voordelen" to make it work correctly.
"imageBgVoordelen"
as a page suffix, but it should be:
"imageBg Voordelen" to make it work correctly.
-
- Moderator
11 posts
• Page 1 of 1