2015-04-04 47 views
0

爲什麼jQuery航點不起作用? 我看過他們的文檔,教程的一切,和它`不工作我完整的代碼:jQuery航點整合

<!DOCTYPE html> 
<html> 
    <head> 
    <script type="text/javascript" src="jquery.js"></script> 
    <script src="jquery.waypoints.min.js"></script> 
    <script src="waypoint.js"></script> 
    <script> 
     $(function(){ 
     var $counter = $('.counter'); 

     $counter.waypoint(function(){ 
      console.log('Waypoint!'); 
     }); 
     }); 
    </script> 
    <style> 
     .space{ 
     height:1200px; 
     background-color:yellow; 
     } 
     .counter{ 
     height:200px; 
     background-color:red; 
     } 
    </style> 
    </head> 
    <body> 
    <div class="space"></div> 
     <div class="counter"></div> 
    </body> 
</html> 
+0

這個例子中的'waypoint.js'是什麼?你已經有了一個jQuery腳本,Waypoint庫腳本,以及在主體中使用Waypoint的JS。 – imakewebthings 2015-04-05 21:57:50

回答

0

默認情況下,航點火當元素的排名靠前的視口的頂部。在你精簡的例子中,我不認爲有足夠的內容讓你的窗口可以滾動,並且你的元素永遠不會觸及窗口的頂部。