2014-10-28 70 views
0

我有一个脚本,用于在页面底部显示滚动页脚菜单,它固定工作,但是当打开页面或在开始时重新加载页脚菜单是可见的。滚动后,它会以我想要的方式做出反应。它适当的很简单,但我的头目前不运作。在滚动页面底部显示页脚菜单

$(window).scroll(function() { 
if ($(this).scrollTop() > 20) { 
    $('footer').slideDown(300); 
} else { 
    console.log('there'); 
    $('footer').slideUp(300); 
}}); 

这里是Fiddle

解决了这个问题我自己我当时就想,我难以忘记设置显示:无;在页脚上。

回答

1

我在下面你的CSS代码改变一个行:

footer { 
    position: fixed; 
    background-color: white; 
    bottom: 0; 
    /* just make the footer display:none when page loading */ 
    display: none; 
    z-index: 300; 
} 

这里是一个链接叉您的演示:http://jsfiddle.net/abruzzi/afgp3ctg/3/

+0

耶士我今天早上发现它和编辑自己的帖子,完全忘了将显示设置为无。 # - )感谢您的帮助!-) – KP83 2014-10-29 12:12:57