2017-06-20 57 views
0

你好,我想使用turbolinksfullpage.js,首先我創建的index.html並插入此代碼head標籤:Fullpage.js和turbolinks集成(全頁無法正常工作)

<head> 
 
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script> 
 
<script src="turbolinks.js?body=1"></script> 
 
<script src="jquery.fullPage.min.js"></script> 
 
<script> 
 

 

 
$(document).on('turbolinks:load', function() { 
 
console.log("It works on each visit!") 
 

 
\t $('#fullpage').fullpage({ 
 
\t \t anchors: ['firstPage', 'secondPage', '3rdPage'], 
 
\t \t sectionsColor: ['#191919', '#191919', '#191919'], 
 
\t \t responsiveHeight: 600, 
 
\t \t navigation: true, 
 
\t \t \t \t \t \t \t  \t 
 
\t \t 
 
\t \t navigationPosition: 'right', \t 
 
\t \t afterResponsive: function(isResponsive){ 
 
\t \t } 
 
\t }); 
 
}); 
 
</head> 
 
<body> 
 
....my html code here .. 
 
</body>

我還創建了第二個頁面demo_page.html並將相同的頭部塊插入到html代碼中。在demo_page.html有一個鏈接到index.html(Testing),當我點擊鏈接它加載index.html通過turbolinks但沒有fullpage函數(在控制檯日誌中沒有錯誤,除了這個fullPage:Fullpage.js只能),當我刷新index.html(通過F5瀏覽器)它通常加載工作滾動部分和其他功能的Fullpage.js 如何解決這個問題,並有人打開工作sorpage項目的fullpage.js和turbolinks集成?

+0

這是關於動態內容和銷燬和初始化fullPage.js。首先,你確定你需要turbolinks嗎?檢查[本主題](https://github.com/alvarotrigo/fullPage.js/issues/115)。 – Alvaro

回答