Change scroll size setting of gkMenuWrap

Rate this topic: Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.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
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
User avatar
Fresh Boarder

GK User
Mon Jun 24, 2013 8:47 am
Reply with quote
Report this post
Its exactly this line:
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.
User avatar
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... :oops:
User avatar
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.
User avatar
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.
User avatar
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?
User avatar
Moderator

GK User
Thu Mar 19, 2015 9:04 am
Reply with quote
Report this post
The URL is http://6gt.nl/
User avatar
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:
User avatar
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.
User avatar
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.
User avatar
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.
User avatar
Moderator


cron
Remember me
Register New Account
If you are old Gavick user, click HERE for steps to retrieve your account.