2010-07-17 34 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>