2017-07-31 39 views
0

我剛安裝了jQuery的slimscroll插件的反應,當我運行調用jQuery插件的反應不工作,但在我的控制檯工作

$('.sk-hits-grid-hit').eq(1).slimScroll({ 
    height: '26em' 
    }); 

在我的控制檯,它將按預期工作,但不會運行在我的應用程序。它不會在我的應用程序中給我任何錯誤,它只是不會做任何事情。我還檢查了開發人員工具中的「網絡」標籤和所有正確導入的文件。

這是我的index.html:

<head> 
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"> 
    </script> 
    <script type="text/javascript" src="node_modules/jquery-slimscroll/jquery.slimscroll.min.js"></script> 
</head> 
... 

這是我index.tsx:

var $ = require("jquery"); 
import 'jquery-waypoints/waypoints.min.js'; //Waypoints trigger functions when you scroll to an element 
import 'jquery/dist/jquery.min.js';    //Allows jQuery functionality 
import 'bootstrap/dist/js/bootstrap.min.js'; //Front-end framework to help display webpage 
import 'jquery-slimscroll/jquery.slimscroll.min.js'; 

... 

$(document).ready(function() { 
    $('.sk-hits-grid-hit').eq(1).slimScroll({ 
     height: '26em' 
    }); 
}) 

任何想法?我嘗試將我的腳本移動到我的身體標記,並沒有改變。

回答

0

似乎是一個參考的問題,請嘗試更改第二參考路徑:

"node_modules/jquery-slimscroll/jquery.slimscroll.min.js" 

關於儘可能我可以建議不知道你的文件路徑

相關問題