- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试同时使用 scrollReveal.js和 onepage-scroll.js
scrollReveal 应该在浏览器显示元素时为元素设置动画。 onepage-scroll 有助于“伪造”一页网站。
似乎它们之间存在冲突:scrollReveal 初始化 加载良好 但当我“向下滚动”到另一个“页面”(onepage-scroll 的 Angular 色)时根本不起作用
这是一个片段:
/* scrollReveal implementation */
var srConf = {
opacity: 1,
reset: true,
delay: "always"
};
var sr = window.sr = new scrollReveal(srConf);
/* onepage-scroll implementation */
$("#onepage-scroll").onepage_scroll({
animationTime: 800,
pagination: false, // I use a custom-made nav
loop: false,
beforeMove: function(index) {
/* makes nav working */
$("#desktop-navbar li.link.on").removeClass("on");
$("#mobile-navbar li.link.on").removeClass("on");
$("#desktop-navbar li.link").eq(index-1).addClass("on");
$("#mobile-navbar li.link").eq(index-1).addClass("on");
},
afterMove: function(index) {
// this is a try - not working
$(document).trigger("scroll");
}
});
$(document).on("click", ".navbar li.link", function() {
/* programmatically "scroll" to another page */
$("#onepage-scroll").moveTo($(this).index()+1);
});
body #desktop-navbar-container {
position: absolute;
top: 20px;
width: 100%;
text-align: center;
z-index: 900;
font-size: 1.5em;
}
body #desktop-navbar-container ul {
margin: 0;
padding: 0;
width: inherit;
}
body #desktop-navbar-container ul li.link {
list-style: none;
display: inline-block;
margin: 0 15px;
cursor: pointer;
}
body #desktop-navbar-container ul li.link:hover,
body #desktop-navbar-container ul li.link.on {
text-decoration: underline;
}
body #desktop-navbar-container ul li.link i.fa {
font-size: 1.5em;
display: inline-block;
margin-right: 10px;
}
<link href="http://www.pskowron.info/css/onepage-scroll.css" rel="stylesheet"/>
<div class="content">
<div id="desktop-navbar-container" class="hidden-xs hidden-sm">
<ul id="desktop-navbar" class="navbar">
<li class="link on">Page 1</li>
<li class="link">Page 2</li>
</ul>
</div>
</div>
<div id="onepage-scroll">
<section id="page1">
<div style="width: 200px; height: 200px; background-color: blue;" data-sr="enter top over 0.9s"></div>
<div style="width: 350px; height: 80px; background-color: red;" data-sr="enter left over 0.4s wait 1s"></div>
</section>
<section id="page2">
<div style="width: 200px; height: 200px; background-color: blue;" data-sr="enter top over 0.9s"></div>
<div style="width: 350px; height: 80px; background-color: red;" data-sr="enter bottom over 0.4s wait 1s"></div>
</section>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="http://www.pskowron.info/js/jquery.onepage-scroll.js"></script>
<script src="http://www.pskowron.info/js/scrollReveal.js"></script>
最佳答案
原因是 onepage-scroll 并没有真正滚动站点,而是更改了插件容器的 translate3d
属性。
如果需要,可以使用 scrollReveal fullpage.js通过 using the option scrollBar:true
这将强制插件显示滚动条,从而使用浏览器提供的真正滚动功能工作。
在任何情况下,您都不需要使用 scrollReveal
,因为您始终可以使用插件提供的回调,例如 afterLoad
或 afterSlideLoad
.
关于javascript - 同时使用 onepage-scroll.js 和 scrollReveal.js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27248094/
所以我正在尝试为这家本地餐馆制作一个网站,现在我正在为 nav ul(菜单)制作拉出动画。以前,我刚刚添加了一些 scrollReveal 动画来为导航栏按钮和介绍消息设置动画。它工作正常......
这是我在这个社区中的第一篇文章。我正准备解决一个与 ScrollReveal.js 代码和我在同一页面上内置的视差组合有关的问题。 我的问题:在我页面的页眉部分,我有一个复杂的视差,其中有多个图层的城
我正在尝试使用 Julian Lloyd ( ScrollReveal ) 编写的广受赞誉的 ScrollReveal.js 我已经按照页面和其他网站上的说明指南进行操作,但是脚本没有提供预期的效果,
我尝试在 modal 上使用 scrollreveal.js。但是当模态滚动时,我在显示内容时遇到了问题。我已经尝试将视口(viewport)(请参阅下面的代码均无效)更改为 myModal 但仍然无
有没有一种方法可以通过单击事件显示带有滚动显示的所有项目? 也许显示所有功能? 问题: 我正在使用滚动显示和同位素。同位素的排序功能与滚动显示 react 奇怪。 当我点击“过滤器”按钮时,我调用了同
滚动时,我正在使用 anijs 为网站上的某些内容制作动画 http://anijs.github.io/ 这是我的代码: data-anijs="if: scroll, on: window, do
注意到当我在 this 上调整浏览器窗口大小时网站底部添加了一堆空间,就在页脚下方。 禁用 Scrollreveal.js 可以解决问题,但我想保留动画。 这个错误在 Chrome/Safari 中很
我读过很多教程,但我很难让 ScrollReveal 正常工作。我有两个主要列,左侧使用滚动条,右侧不滚动。 控制台中没有错误,当我检查我想要显示的 div 元素时,我得到了这个: text
我在将 scrollreveal.js 与 flexbox 一起使用时遇到问题。 我已经使用 display flex 在页面上创建了一些两列的行,当尝试使用 scrollreveal 引用分别显示每
我正在使用Scrollreveal.js在我的网站上显示一些 div。 现在我希望 Scrollreveal 在显示特定 div 后调用函数。 正如文档所述: ”//为每个完成的元素触发的回调显示并重
我一直在查看包含此错误的不同论坛,并尝试使用我阅读过的不同内容来消除此错误。我曾尝试删除任何重复的库,并更改它们出现的顺序,但似乎对我没有任何作用。我正在使用 Bootstrap 主题 scrollr
我想在我的项目中将 ScrollReveal.js ( https://github.com/julianlloyd/scrollReveal.js ) 与 Isotope 一起使用,以便在用户滚动时
我目前正在使用 ScrollReveal.js 使一堆微小的像素化框在滚动时做随机的事情,代码如下: var index=0; $(document).ready(function(){ jQ
我正在尝试同时使用 scrollReveal.js和 onepage-scroll.js scrollReveal 应该在浏览器显示元素时为元素设置动画。 onepage-scroll 有助于“伪造”
我是一名优秀的程序员,十分优秀!