隧芒官网
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

20 lines
486 B

  1. let video1 = document.getElementById("video1");
  2. let video2 = document.getElementById("video2");
  3. video1.play();
  4. window.onscroll = function () {
  5. var t = document.documentElement.scrollTop || document.body.scrollTop; //变量t就是滚动条滚动时,到顶部的距离
  6. console.log(video2.pause);
  7. // video2.pause()
  8. if (t < 700) {
  9. video2.pause();
  10. video1.play();
  11. } else if (t >= 700) {
  12. video1.pause();
  13. video2.play();
  14. }
  15. }