[英]I'm trying to make my navbar retract upwards when I scroll down and then appear again when I scroll up, but it doesn't do anything
[英]I wanted to restart the video when full page js scroll up and down, anything i can do for this?
我使用整頁 js,它可以在我滾動時播放和暫停,但問題是我想在向上或向下滾動時重新啟動視頻
<div id="fullpage">
<div class="section">
<video style="object-fit: cover"
id="videoPlay"
tabindex="-1"
muted="muted"
data-autoplay
webkit-playsinline
playsinline
class="my-video-scroll"
id="slide1"
data-no-fullscreen="true"
controlslist="nodownload"
loop
controls>
<source src="../video/video1.mp4"></video>
</div>
<div class="section">
<video style="object-fit: cover"
id="videoPlay"
tabindex="-1"
muted="muted"
data-autoplay
webkit-playsinline
playsinline
class="my-video-scroll"
id="slide2"
data-no-fullscreen="true"
controlslist="nodownload"
loop
controls>
<source src="../video/video2.mp4"></video>
</div>
</div>
使用諸如onLeave
之類的 fullPage.js 回調,然后在每次離開該部分時使用它來重新啟動視頻。
這是一個例子:
new fullpage('#fullpage',{
onLeave: function(origin, destination, direction, trigger){
if(origin.anchor = 'my-video-section-anchor'){
var video = document.getElementById('myVideoId');
video.pause();
video.currentTime = 0;
video.load();
}
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.