[英]How to use jScroll plugin?
我想使用jScroll插件来滚动到页面底部时加载另一个网页。 我已经按照说明进行了设置,可以看到该插件正在生成一些代码,但是该插件无法正常工作。 在这里的任何帮助将不胜感激。
HTML:
<script src="../js/jquery.jscroll.min.js"></script>
<div class="wrapper scroll">
<!-- Start module A - Header -->
<div class="a">
<div class="module__container header__mobile">
<div class="work__flex--item">
<div class="header__mobile--img full work_overlay">
</div>
<div class="overlay__text">
<h3 class="overlay__text--header" style="margin-bottom: 6px !important;">AMUR</h3>
<p class="h5 overlay__text--sub" style="margin-bottom: 15px !important; marg
in-top: 0px; font-weight: normal;">Materials making a difference.</p>
</div>
</div>
</div>
<div class="module__container header__other">
<div class="header__text--container">
<h2 style="color: white; margin-top: 35px !important; margin-bottom: 5px !important;">AMUR</h2> <!-- Title -->
<h5 style="color: white; font-weight: normal; margin-top: 0px !important;">Materials making a difference.</h5> <!-- Subtitle -->
</div>
<div class="header__image--overlap">
<img class="img__full" src="../css/images/work-template/amur/amur_overlay.png" style="height: auto !important;"> <!-- Path to header image file -->
</div>
</div>
</div>
<!-- End module A - Header -->
<a href="gohrvst.com/work/bench.html">next page</a>
</div>
jQuery的:
<script>
$('.scroll').jscroll();
$('.infinite-scroll').jscroll({
autoTrigger: true
});
</script>
您有几个问题要解决:
1)您只需要定位页面的内容区域。 一旦滚动过去/结束,“ jscroll”希望将新内容加载到区域中。 目前,您的包装器div占据了从上到下的所有页面。 尝试仅在页面内容周围添加一个新的div(例如: <div class="content">....</div>
)。
2)在要用于下一页加载的链接中添加一个类(例如:jscroll-next)-您将在初始化jscroll插件时使用该类,以明确地将该链接定位为新页面。
删除您的jquery并进行如下更改:
$('.content').jscroll({
nextSelector: 'a.jscroll-next:last'
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.