无法与.wrapall()一起包含Lottie-player标签
每次在此代码上都有H2
on 文章
我将所有内容从h2
中获取,直到下一个h2
h2 并将其包装在节
上。
<article>
<h2>Lottie Files</h2>
<div class='lottie-wrapper>
<lottie-player src='' background="transparent" speed="1"></lottie-player>
</div>
</article>
$('article h2').each(function () {
$(this).nextUntil('h2').addBack().wrapAll('<section />')
})
但是由于某种原因,如果有&lt; lottie-player&gt;
标签,则代码将其从DOM中删除。
仅当我将lottiefiles Interactivity脚本与上述片段
https://unpkg.com/@lottiefiles/lottie-interactive@latest/dist/dist/lottie-interactivity.min.min.min.js
这是 时,才发生这种情况。仅在简单的HTML上进行WordPress上发生并不是问题。
如果我从包装纸上删除一个名为.lottie-wrapper
的父级div,则可以直接调用lottie-player
$('article h2').each(function () {
$(this)
.nextUntil('h2')
.addBack()
.not('.lottie-wrapper')
.wrapAll('<section />')
})
标签播放器里面
On this code each time there is an h2
on article
I take all of the content from the h2
till the next h2
and wrap it on a section
.
<article>
<h2>Lottie Files</h2>
<div class='lottie-wrapper>
<lottie-player src='' background="transparent" speed="1"></lottie-player>
</div>
</article>
$('article h2').each(function () {
$(this).nextUntil('h2').addBack().wrapAll('<section />')
})
But for some reason if there is the <lottie-player>
tag, the code removes it from the DOM.
It only happens when I include lottieFiles interactivity script in conjunction with the above snippet
https://unpkg.com/@lottiefiles/lottie-interactivity@latest/dist/lottie-interactivity.min.js
This is happening on WordPress only on a simple html is not a problem.
If I remove a parent div called .lottie-wrapper
from the wrap then it works, but not just calling the lottie-player
tag directly
$('article h2').each(function () {
$(this)
.nextUntil('h2')
.addBack()
.not('.lottie-wrapper')
.wrapAll('<section />')
})
But of course I want the lottie-player inside
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这很奇怪,只有在WordPress上发生,并且只有当我使用脚本
https://unpkg.com/@lottiefiles/lottie-player@latest/dist/lottie-player.js
以及jQuery
wrapall()
。我通过使用旧版本的脚本https://unpkg.com/@lottiefiles/ [email&nbsp; prectioned] /dist/lottie-player.js
This was pretty bizarre, it only happened on WordPress and only when I use the script
https://unpkg.com/@lottiefiles/lottie-player@latest/dist/lottie-player.js
Together with the jQuery
wrapAll()
. I fixed it by using an older version of the scripthttps://unpkg.com/@lottiefiles/[email protected]/dist/lottie-player.js