我正在按照本指南检测我的视频元素何时进入视口,然后执行“x”,但不断收到标题错误。不知道是不是因为我使用带有 gulp 和piling.js的 wordpress
我的页面使用 Piling 并且我有一个视频部分,当我滚动到该“堆栈”时,我希望视频开始播放,但它在页面加载时开始播放。
// inside document.ready()
$('video').each(function(){
if ($(this).is(":in-viewport")) {
$(this)[0].play();
} else {
$(this)[0].pause();
}
})
未捕获的错误:语法错误,无法识别的表达式:不支持的伪:in-viewport
<div id='<ID-CHANGES-INSIDE-LOOP>' class='image-block'>
<video autoplay>
<source class='video' src='movie.mp4' type='video/mp4'>
</video>
</div>
使用打桩会使这难以工作吗?