我正在尝试使用jQuery插件Infinite-Scroll但没有成功。我的问题是插件不起作用,没有任何反应,甚至是控制台错误,一切看起来都很好。我需要使用这个,因为我将使用另一个插件(jQuery Masonry)及其支持并推荐Infinite-Scroll。我让砌体轻松工作,但不是Infinite-Scroll。
所以我开始在测试页面中单独测试Infinite-Scroll,但没有。 有什么帮助吗?
的test.html
<!DOCTYPE html>
<html>
<head>
<title>Infinite-Scroll Test</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="jquery.infinitescroll.min.js"></script>
<style>
#container {
width: 600px;
margin: 30px auto;
}
.element {
background: #666;
width: 100px;
height: 500px;
margin: 5px;
float: left;
}
</style>
</head>
<body>
<script>
$(function() {
var $container = $('#container');
$container.infinitescroll({
navSelector : '#page-nav', // selector for the paged navigation
nextSelector : '#page-nav a', // selector for the NEXT link (to page 2)
itemSelector : '.element', // selector for all items you'll retrieve
loading: {
finishedMsg: 'No more pages to load.',
img: 'http://i.imgur.com/6RMhx.gif'
}
});
});
</script>
<div id="container">
<div class="element">
test
</div>
<div class="element">
test
</div>
<div class="element">
test
</div>
<div class="element">
test
</div>
<div class="element">
test
</div>
<div class="element">
test
</div>
<div class="element">
test
</div>
<div class="element">
test
</div>
<div class="element">
test
</div>
<div class="element">
test
</div>
<div class="element">
test
</div>
<div class="element">
test
</div>
<div class="element">
test
</div>
<div class="element">
test
</div>
</div>
<nav id="page-nav">
<a href="next.html"></a>
</nav>
</body>
</html>
next.html
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div id="container">
<div class="element">
new one
</div>
<div class="element">
new one
</div>
<div class="element">
new one
</div>
<div class="element">
new one
</div>
<div class="element">
new one
</div>
<div class="element">
new one
</div>
<div class="element">
new one
</div>
<div class="element">
new one
</div>
<div class="element">
new one
</div>
<div class="element">
new one
</div>
<div class="element">
new one
</div>
<div class="element">
new one
</div>
<div class="element">
new one
</div>
<div class="element">
new one
</div>
</div>
</body>
</html>
答案 0 :(得分:0)
此链接可以帮助您进行配置: http://beaver6813.com/2012/01/selectors-in-infinite-scroll/
我注意到无限卷轴网站已关闭。