Same mainmenu like in the new Event Template

GK User
Mon Jul 14, 2014 9:45 am
hi there,

is there a possibility to set the same mainmenu technology like in the new event template?
i mean...is it possible to fade in the mainmenu, when the user scroll down? this feature would be great and will make the university template absolutely perfect!

thanks

sven
User avatar
Fresh Boarder

GK User
Mon Jul 14, 2014 12:08 pm
It would require some JS coding, but what is more - some css designing changes. Are you ready for that kind of changes?
User avatar
Moderator

GK User
Wed Jul 16, 2014 1:03 pm
sure. when it is possible to solve it, it would be great!
User avatar
Fresh Boarder

GK User
Mon Jul 21, 2014 6:37 am
First thing to do is to edit file:
templates/gk_university/js/gk.scripts.js
and add at its end:
Code: Select all
jQuery(document).ready(function() {   
   jQuery(window).scroll(function() {
      var currentPosition = jQuery(window).scrollTop();
      var scrollSize = 100;
      if ( currentPosition >= scrollSize &&  !jQuery('#gkHeaderNav').hasClass('active') ) {
         jQuery('#gkHeaderNav').addClass('active');
      } else if ( currentPosition < scrollSize && jQuery('#gkHeaderNav').hasClass('active') ) {
         jQuery('#gkHeaderNav').removeClass('active');
      }
   });
});

What the code does - it checks how much user have scrolled down, and if the scroll pixel value is larger than 100 - it adds additional class to #gkHeaderNav element so we can use it in css.
Modify 100 value to suit your needs after whole setup is finished.
User avatar
Moderator

GK User
Mon Jul 21, 2014 6:40 am
Now you need to add some styling to menu when it is in "active" state.
Please edit: /templates/gk_university/css/override.css and add at its end:
Code: Select all
#gkHeaderNav.active {position: fixed; background: blue; padding: 10px 0;}

This is of course sample background colour - you need to set up one that appeals you. Also top padding is reduced so header is not that much big.
Remember to enable "CSS override" in template settings - advanced section.
User avatar
Moderator

GK User
Sun Jan 04, 2015 7:28 pm
hi Cyberek!
I wanted to do the same on my site!!!! :)
In which file i need to make changes?
---------"First thing to do is to edit file: JS coding"-------------
User avatar
Senior Boarder

GK User
Tue Jan 06, 2015 10:51 am
I have added missing filename to original post:
templates/gk_university/js/gk.scripts.js
User avatar
Moderator


cron