gpt4 book ai didi

javascript - Skrollr 无法移动超过 20 个对象

转载 作者:行者123 更新时间:2023-11-28 06:35:49 25 4
gpt4 key购买 nike

我正在使用 skrollr 开发一个页面,其中包含几个词,当您向下滚动页面并以词云结尾时会出现这些词。使用的函数有 opacity、transform:rotate、transform translateX、translateY。 Skrollr 版本为 0.6.30。在我达到第 20 个字和第 20 个字之后的另一个字之前,它工作得很好。这些最新的词会移动,但通常会停在预期路径的中间。这主要发生在您高速滚动时。在上面您可以看到 Word20 和 Word21 无法正常工作的代码。

.word5{
font-weight: 400;
font-size: 35px;
line-height: 35px;
text-align:center;
word-wrap:break-word;
white-space: nowrap;
}
.word4{
font-weight: 400;
font-size: 25px;
text-align:center;
word-wrap:break-word;
white-space: nowrap;
}
.word3{
font-weight: 300;
font-size: 20px;
text-align:center;
word-wrap:break-word;
white-space: nowrap;
}
<html>
<body>
<p class="word5"
data-100="opacity:0; transform:rotate(90deg) translateX(700px) translateY(200px)"
data-500="opacity:1; transform:rotate(90deg) translateX(125px) translateY(-40px)"
data-2000="opacity:0; transform:rotate(90deg) translateX(125px) translateY(-40px)">
WORD1</p>
<p class="word5"
data-100="opacity:0; transform:rotate(0deg) translateX(500px) translateY(500px)"
data-500="opacity:1; transform:rotate(0deg) translateX(175px) translateY(130px)"
data-2000="opacity:0; transform:rotate(0deg) translateX(175px) translateY(130px)">
WORD2</p>
<p class="word5"
data-100="opacity:0; transform:rotate(-90deg) translateX(20px) translateY(700px)"
data-500="opacity:1; transform:rotate(-90deg) translateX(20px) translateY(345px)"
data-2000="opacity:0; transform:rotate(-90deg) translateX(20px) translateY(345px)">
WORD3</p>
<p class="word5"
data-100="opacity:0; transform:rotate(90deg) translateX(0px) translateY(800px)"
data-500="opacity:1; transform:rotate(90deg) translateX(0px) translateY(190px)"
data-2000="opacity:0; transform:rotate(90deg) translateX(0px) translateY(190px)">
WORD4</p>
<p class="word5"
data-100="opacity:0; transform:rotate(0deg) translateX(-600px) translateY(400px)"
data-500="opacity:1; transform:rotate(0deg) translateX(-55px) translateY(60px)"
data-2000="opacity:0; transform:rotate(0deg) translateX(-55px) translateY(60px)">
WORD5</p>
<p class="word4"
data-300="opacity:0; transform:rotate(0deg) translateX(900px) translateY(500px)"
data-600="opacity:1; transform:rotate(0deg) translateX(490px) translateY(-30px)"
data-2000="opacity:0; transform:rotate(0deg) translateX(490px) translateY(-30px)">
WORD6</p>
<p class="word4"
data-300="opacity:0; transform:rotate(90deg) translateX(900px) translateY(-580px)"
data-600="opacity:1; transform:rotate(90deg) translateX(10px) translateY(-580px)"
data-2000="opacity:0; transform:rotate(90deg) translateX(10px) translateY(-580px)">
WORD7</p>
<p class="word4"
data-300="opacity:0; transform:rotate(90deg) translateX(900px) translateY(-300px)"
data-600="opacity:1; transform:rotate(90deg) translateX(95px) translateY(-300px)"
data-2000="opacity:0; transform:rotate(90deg) translateX(95px) translateY(-300px)">
WORD8</p>
<p class="word4"
data-300="opacity:0; transform:rotate(0deg) translateX(900px) translateY(500px)"
data-600="opacity:1; transform:rotate(0deg) translateX(290px) translateY(60px)"
data-2000="opacity:0; transform:rotate(0deg) translateX(290px) translateY(60px)">
WORD9</p>
<p class="word4"
data-300="opacity:0; transform:rotate(-90deg) translateX(-800px) translateY(-300px)"
data-600="opacity:1; transform:rotate(-90deg) translateX(50px) translateY(-20px)"
data-2000="opacity:0; transform:rotate(-90deg) translateX(50px) translateY(-20px)">
WORD10</p>
<p class="word4"
data-300="opacity:0; transform:rotate(0deg) translateX(-600px) translateY(180px)"
data-600="opacity:1; transform:rotate(0deg) translateX(-50px) translateY(180px)"
data-2000="opacity:0; transform:rotate(0deg) translateX(-50px) translateY(180px)">
WORD11</p>
<p class="word4"
data-300="opacity:0; transform:rotate(0deg) translateX(-600px) translateY(-200px)"
data-600="opacity:1; transform:rotate(0deg) translateX(-110px) translateY(-125px)"
data-2000="opacity:0; transform:rotate(0deg) translateX(-110px) translateY(-125px)">
WORD12</p>
<p class="word4"
data-300="opacity:0; transform:rotate(-90deg) translateX(-800px) translateY(-300px)"
data-600="opacity:1; transform:rotate(-90deg) translateX(-215px) translateY(-125px)"
data-2000="opacity:0; transform:rotate(-90deg) translateX(-215px) translateY(-125px)">
WORD13</p>
<p class="word4"
data-300="opacity:0; transform:rotate(0deg) translateX(-800px) translateY(-100px)"
data-600="opacity:1; transform:rotate(0deg) translateX(-110px) translateY(140px)"
data-2000="opacity:0; transform:rotate(0deg) translateX(-110px) translateY(140px)">
WORD14</p>
<p class="word4"
data-300="opacity:0; transform:rotate(0deg) translateX(900px) translateY(200px)"
data-600="opacity:1; transform:rotate(0deg) translateX(490px) translateY(75px)"
data-2000="opacity:0; transform:rotate(0deg) translateX(490px) translateY(75px)">
WORD15</p>
<p class="word4"
data-300="opacity:0; transform:rotate(0deg) translateX(-800px) translateY(100px)"
data-600="opacity:1; transform:rotate(0deg) translateX(-185px) translateY(-30px)"
data-2000="opacity:0; transform:rotate(0deg) translateX(-185px) translateY(-30px)">
WORD16</p>
<p class="word4"
data-300="opacity:0; transform:rotate(-90deg) translateX(-800px) translateY(800px)"
data-600="opacity:1; transform:rotate(-90deg) translateX(-145px) translateY(445px)"
data-2000="opacity:0; transform:rotate(-90deg) translateX(-145px) translateY(445px)">
WORD17</p>
<p class="word4"
data-300="opacity:0; transform:rotate(0deg) translateX(900px) translateY(200px)"
data-600="opacity:1; transform:rotate(0deg) translateX(335px) translateY(105px)"
data-2000="opacity:0; transform:rotate(0deg) translateX(335px) translateY(105px)">
WORD18</p>
<p class="word4"
data-300="opacity:0; transform:rotate(0deg) translateX(400px) translateY(600px)"
data-600="opacity:1; transform:rotate(0deg) translateX(335px) translateY(85px)"
data-2000="opacity:0; transform:rotate(0deg) translateX(335px) translateY(85px)">
WORD19</p>
<p class="word4"
data-400="opacity:0; transform:rotate(90deg) translateX(900px) translateY(-580px)"
data-700="opacity:1; transform:rotate(90deg) translateX(155px) translateY(-455x)"
data-2000="opacity:0; transform:rotate(90deg) translateX(155px) translateY(-455px)">
WORD20</p>
<p class="word3"
data-400="opacity:0; transform:rotate(0deg) translateX(-900px) translateY(-580px)"
data-700="opacity:1; transform:rotate(0deg) translateX(0px) translateY(0x)"
data-2000="opacity:0; transform:rotate(0deg) translateX(0px) translateY(0px)">
WORD21</p>
</body>
<script src="js/jquery-1.11.3.min.js" type="text/javascript"></script>
<script src="js/bootstrap.min.js" type="text/javascript"></script>
<script src="js/skrollr.min.js" type="text/javascript"></script>
<script type="text/javascript">
skrollr.init({
smoothScrolling: false,
mobileDeceleration: 0.004
});
</script>
</html>

有谁知道这是 skroll 还是 javascript 的一种限制?或者有人知道达到相同输出的方法吗?非常感谢。

最佳答案

我发现了问题所在。我写了“x”而不是“px”,并且通过一些复制和粘贴,我复制了使浏览器无法轻松解释移动坐标的错误。一个非常愚蠢的错误。

关于javascript - Skrollr 无法移动超过 20 个对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34695683/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com