我想讓iScroll爲我的webapp工作(不幸的是,本地滾動並沒有做到我所需要的一切)。我必須初始化它,因爲它現在只是禁用滾動。出了什麼問題?爲什麼iScroll未初始化?
var myScroll;
$(document).ready(function() {
setTimeout(function() {
myScroll = new IScroll('#page-content-wrapper', {
probeType: 3,
mouseWheel: true,
tap: true,
scrollbars: true
});
}, 300);
});
<script src="https://raw.githubusercontent.com/cubiq/iscroll/master/build/iscroll-probe.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<div id="page-content-wrapper">
<div class="container">
<div class="row page-header">
<div class="col-sm-12 col-md-5 col-md-offset-2">
<h2>Breakfast menu</h2> </div>
<div class="row">
<div class="col-sm-12 col-md-8 col-md-offset-2">
<ul class="list-group">
<li class="list-group-item">A cool list item!</li>
<li class="list-group-item">A cool list item!</li>
<li class="list-group-item">A cool list item!</li>
<li class="list-group-item">A cool list item!</li>
<li class="list-group-item">A cool list item!</li>
<li class="list-group-item">A cool list item!</li>
<li class="list-group-item">A cool list item!</li>
<li class="list-group-item">A cool list item!</li>
<li class="list-group-item">A cool list item!</li>
<li class="list-group-item">A cool list item!</li>
<li class="list-group-item">A cool list item!</li>
<li class="list-group-item">A cool list item!</li>
<li class="list-group-item">A cool list item!</li>
<li class="list-group-item">A cool list item!</li>
<li class="list-group-item">A cool list item!</li>
<li class="list-group-item">A cool list item!</li>
<li class="list-group-item">A cool list item!</li>
</ul>
</div>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://raw.githubusercontent.com/cubiq/iscroll/master/build/iscroll-probe.js"></script>
我想引用IScroll是錯誤的becouse調試時,新的IScroll()不確定。 – Zorken17
而且您還需要擁有正確的CSS,並且只能使用引導程序。 – Zorken17