Gordon Arber
Gordon Arber

Reputation: 1

.load not loading fast enough

I am trying to have a menu hidden when the page first loads and then have to show 850px down the page. It all works pretty well except that when you load www.ripplesofgrace.com the menu flashes really quick. I would like to avoid this. Any suggestions? My code currently is:

jQuery(function($){
  $(window).load(function(){
         $('#whiteBar').hide();
    });
});

jQuery(function($){
  $(window).scroll(function(){
    var aTop = $('#whiteBar').height()+850;
    if($(this).scrollTop()>=aTop){
         $('#whiteBar').show();
      } else {
         $('#whiteBar').hide(); 
    };
  });
});

Upvotes: 0

Views: 92

Answers (1)

Roamer-1888
Roamer-1888

Reputation: 19288

Initially, hide the element with a CSS directive, either inline or in a style sheet.

#whiteBar { 
    display: none
}

That will give it just about zero chance of being seen before the javascript has a chance to act upon it.

Upvotes: 1

Related Questions