2010-07-17 51 views
5

当您在Tumblr上启用无限滚动功能时,当您将鼠标放在仪表板的底部时,页脚会淡入。如何将该技术用于我的网站?类似于Tumblr的页脚

回答

3

如果你使用jQuery库,它会很容易。

让我们假设你有一个ID =“页脚”下面的页脚DIV与自定义样式

<div id="footer" style="position:fixed;bottom:0px;left:0px;margin:0px;width:100%;opacity:0.001"> 
    <center>StackOverflow | About US | Privacy | Blah Blah Blah | Something </center> 
</div> 

然后添加以下Java脚本

<script type="text/javascript"> 
    $(document).ready(function() { 
    $('#footer').hover(
     function(){ 
      $(this).stop().fadeTo('slow',1); 
     }, 
     function(){ 
      $(this).stop().fadeTo('slow',0.001); 
     }); 

    }); 
</script> 

确保你已经包括了jQuery图书馆,如果不是只是将以下行添加到您的头部分:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>