私のプロジェクトで無限のajaxスクロールプラグインを使用しようとしています。私はちょうど公式のウェブサイトに続き、必要なjavascriptファイルを含んでいます。以下は私のコードです:無限のajaxスクロールがDjangoで動作しませんでした
<div class="row">
<div class="col-lg-4">
<div class="bootstrap-card">
<img src="{% static 'images/1.jpg' %}" class="img-responsive img-rounded" alt="card imag">
<div class="overlay">
<a class="info" href="#">View Details</a>
</div>
</div>
</div>
<div class="col-lg-4">
<div class="bootstrap-card">
<img src="{% static 'images/1.jpg' %}" class="img-responsive img-rounded" alt="card imag">
<div class="overlay">
<a class="info" href="#">View Details</a>
</div>
</div>
</div>
<div class="col-lg-4">
<div class="bootstrap-card">
<img src="{% static 'images/1.jpg' %}" class="img-responsive img-rounded" alt="card imag">
<div class="overlay">
<a class="info" href="#">View Details</a>
</div>
</div>
</div>
</div>
<script src="{% static 'hw1/js/callback.js' %}"></script>
<script src="{% static 'hw1/js/jquery-ias.min.js' %}"></script>
<div id="pagination">
<a href="page2.html" class="next">next</a>
</div>
<script>
$(document).ready(function() {
var ias = jQuery.ias({
container: '.row',
item: '.col-lg-4',
pagination: '#pagination',
next: '.next',
delay: 1250
});
});
ias.extension(new IASSpinnerExtension());
ias.extension(new IASTriggerExtension({offset: 2}));
ias.extension(new IASNoneLeftExtension({text: "You reached the end"}));
</script>
だからここのpage2.htmlは別のページです。
エラーメッセージがあるだから、なぜ誰もが知っているん:
(index):244 Uncaught ReferenceError: ias is not defined(…)(anonymous function) @ (index):244 jquery-3.1.1.min.js:2 jQuery.Deferred exception: jQuery.ias is not a function TypeError: jQuery.ias is not a function at HTMLDocument. (http://localhost:8000/:235:24) at j (http://localhost:8000/static/hw1/js/jquery-3.1.1.min.js:2:29948) at k (http://localhost:8000/static/hw1/js/jquery-3.1.1.min.js:2:30262) undefined
こんにちは、ありがとうございます。しかし、私はまだ同じエラーが発生します。 jquery-3.1.1.min.jsで定義されている関数を探しているようです。エラーメッセージは次のとおりです。jquery-3.1.1.min.js:2 jQuery.Deferred exception:jQuery.iasは関数ではありません。TypeError:jQuery.iasがHTMLDocumentの関数 ではありません。(http:// localhost:8000 /:235:24) j(http:// localhost:8000/static/hw1/js/jquery-3.1.1.min.js:2:29948) at k (http:// localhost:8000/static/hw1/js/jquery-3.1.1.min.js:2:30262) –
user2970089
@ user2970089はhttp:// localhost:8000/static/hw1/js/jquery-iasです.min.jsはjavascriptを返しますか、エラーになりますか?エラーが発生した場合、静的ファイルが正しく設定されていないか、URLに誤字があります。 – Soviut
私はJavaScriptを返します。私はタイプミスがないことを確認し、他のjavascriptファイルを追加するのにも同様のことを使用します。だから私はこの機能が見つからない理由を混乱しています... – user2970089