2014-12-18 25 views

回答

0

你不需要插件。嘗試這樣的jQuery:

$(document).ready(function() { 
 

 
    //Check to see if the window is top if not then display button 
 
    $(window).scroll(function() { 
 
    if ($(this).scrollTop() > 100) { 
 
     $('.nextPost').fadeIn(); 
 
    } else { 
 
     $('.nextPost').fadeOut(); 
 
    } 
 
    }); 
 
});
.nextPost { 
 
    background: lightgray; 
 
    font-weight: bold; 
 
    position: fixed; 
 
    top: 5px; 
 
    right: 5px; 
 
    display: none; 
 
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
 
<div class="nextPost">Next Post</div> 
 

 
<br/> 
 
<br/> 
 
<br/> 
 
<br/> 
 
<br/> 
 
<br/> 
 
<br/> 
 
<br/> 
 
<br/> 
 
<br/> 
 
<br/> 
 
<br/> 
 
<br/> 
 
<br/> 
 
<br/> 
 
<br/> 
 
<br/> 
 
<br/> 
 
<br/> 
 
<br/> 
 
<br/> 
 
<br/> 
 
<br/>

+0

這是偉大的。我會試試這個。 – berzeek

相關問題