Way to have menu appear on scroll earlier?

GK User
Mon May 18, 2015 3:40 am
Hi,

On my client's site, just like the Steakhouse demo - https://demo.gavick.com/joomla25/steakhouse/ - the menu doesn't appear until you scroll quite a bit and the steak image vanishes completely. My client is wondering if it's possible for the menu to appear earlier, i.e. shortly after someone starts scrolling down?

Thank you,
Chris
User avatar
Fresh Boarder

GK User
Mon May 18, 2015 6:49 am
Please edit this file:
templates/gk_steakhouse/js/gk.scripts.js
find this section:
Code: Select all
      jQuery(window).scroll(function() {
         var currentPosition = jQuery(window).scrollTop();

         if(
            currentPosition >= jQuery('#gkHeader').height() &&
            !jQuery('#gkHeaderNav').hasClass('active')
         ) {
            jQuery('#gkHeaderNav').addClass('active');
         } else if(
            currentPosition < jQuery('#gkHeader').height() &&
            jQuery('#gkHeaderNav').hasClass('active')
         ) {
            jQuery('#gkHeaderNav').removeClass('active');
         }
      });

and replace each:
Code: Select all
jQuery('#gkHeader').height()

with number corresponding to pixels that need to be scrolled (right now it is set to header height), so it looks like:
Code: Select all
      jQuery(window).scroll(function() {
         var currentPosition = jQuery(window).scrollTop();

         if(
            currentPosition >= 600 &&
            !jQuery('#gkHeaderNav').hasClass('active')
         ) {
            jQuery('#gkHeaderNav').addClass('active');
         } else if(
            currentPosition < 600 &&
            jQuery('#gkHeaderNav').hasClass('active')
         ) {
            jQuery('#gkHeaderNav').removeClass('active');
         }
      });
User avatar
Moderator

GK User
Tue May 19, 2015 3:15 am
Cyberek wrote:Please edit this file:
templates/gk_steakhouse/js/gk.scripts.js
find this section:


I'll give that a try. Thanks for the prompt reply!

Chris
User avatar
Fresh Boarder

GK User
Thu May 21, 2015 6:18 pm
Please let me know if this solution works as expected.
User avatar
Moderator

GK User
Fri May 29, 2015 7:11 am
Cyberek wrote:Please let me know if this solution works as expected.


It worked! I used a value of 20 pixels, since my client wanted the menu to appear as soon as someone started scrolling.

Chris

P.S. Sorry for the late reply, didn't have a chance to fully explore this until today.
User avatar
Fresh Boarder

GK User
Sun May 31, 2015 9:35 am
I'm glad it works :).
Is there anything else I can help you with regarding this topic?
User avatar
Moderator


cron