我跟隨this guide來檢測我的視頻元素何時進入視口,然後執行「x」,但不斷收到標題錯誤。不知道是否因爲我使用wordpress與吞噬和piling.js不受支持的僞:在視口中
我的頁面使用打樁,我有一個視頻部分,當我滾動到「堆棧」,我想視頻開始播放,但它開始播放頁面加載。
// inside document.ready()
$('video').each(function(){
if ($(this).is(":in-viewport")) {
$(this)[0].play();
} else {
$(this)[0].pause();
}
})
Uncaught Error: Syntax error, unrecognized expression: unsupported pseudo: in-viewport
<div id='<ID-CHANGES-INSIDE-LOOP>' class='image-block'>
<video autoplay>
<source class='video' src='movie.mp4' type='video/mp4'>
</video>
</div>
是採用打樁做出這一困難的工作?
我必須承認,這是答案大聲笑。謝謝 – Sylar