I have a bar at the top of my page. When a user scrolls past 700 px
jquery will put the formerly hidden logo into the bar using this code:
$(window).scroll(function(){
var posFromTop = $(window).scrollTop();
if(posFromTop > 700){
$('#logo').fadeIn(200, function(){
});
} else {
$('#logo').fadeOut(200, function(){
});
}
});
That works great, but I have a link in that bar that gets pushed down when the #logo
appears. How can i prevent the link from moving when the #logo
appears.
Link code:
<div class="container-fluid" style='height: 50px; background-color:rgba(242, 244, 247, 0.5); width: 100%; position: fixed; top: 0; left: 0; z-index: 30;'>
<a href='#' id='logo' style='font-size: 40px;'>logo</a>
<a href='#t' style='position: absolute; right: 12px;'>Start</a>
Logo code:
#logo{
display: none;
}
` tags to allow scrolling: http://jsfiddle.net/PwX93/1/. – Brandon Gano Jul 25 '14 at 05:17