2014-11-23 56 views

回答

1

你可以使用:
https://github.com/thesmart/jquery-scrollspy
並進行自定義,如:

//include jQuery lastest 
//<script type="text/javascript" src="scrollspy.js"></script> 
<script> 
$('.scrollsp').on('scrollSpy:enter', function() {//when scrolling and element showing in window 
    $(this).fadeIn(); 
}); 

$('.scrollsp').on('scrollSpy:exit', function() {//when scrolling and element exit at window 
    $(this).fadeOut(); 
}); 

$('.scrollsp').scrollSpy(); 
</script> 
<div class="scrollsp"></div> 
<div class="scrollsp"></div> 
<div class="scrollsp"></div> 
<div class="scrollsp"></div> 

http://jsfiddle.net/gmpckvwq/

+0

你可以把這個代碼在的jsfiddle嗎?! – MahEs 2014-11-23 01:20:14

+1

http://jsfiddle.net/gmpckvwq/ – 2014-11-23 01:29:56

相關問題