Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

166
Visualizações
HTML5 FPS drops on scrolling page when a video tag & js exist

I am editing a website and playing a video for this website on the homepage. The video I play starts as autoplay and there is a button on the video using zIndex. When this button is triggered, the current video tag turns itself into a comment line and the other video becomes active. I used javascript and html coding for this. The problem is that when scrolling up and down the part of the website where these videos are visible, stuttering occurs. It looks like an FPS drop image. What can I do about it, what can I optimize? I work on wordpress and add this code as raw js to the page. *Rest of the page works normal when video frame is out of window view.

When i scroll down, everything is smooth but when i go up and see video a bit, here lag comes*

Here is my code:

<div class="video-wrap">
<button style="
    font-family: 'Font Proxima Nova Regular';
    font-size: 13px;
    font-weight: bold;
    font-stretch: normal;
    font-style: normal;
    letter-spacing: 1.5px!important;
    color: #fff;
    background-color: #E21C90FF;
    border-color: #E21C90FF;
    border-radius: 10px;
    position: absolute;
    z-index: 1;
    top: 78%;
    right: 38%;
">
    HOW PROGRAM WORKS?
  </button>
  <span></span>
  <video id="video1" style="position: relative; left: -13px; border-radius: 10px;" autoplay="autoplay" loop="loop" muted="" width="575" height="324"><source src="video1.mp4" type="video/mp4" />
</video>

<!--<video onloadstart="this.volume=0.25" controls id="video2" style="position: relative; left: -13px; border-radius: 10px;" loop="loop" autoplay="autoplay" width="575" height="324"><source src="video2.mp4" type="video/mp4" />
</video>-->
</div>

<script>
jQuery(function () {
  var videos = jQuery(".video-wrap");

  videos.on("click", function () {
    var elm = jQuery(this),
      conts = elm.contents(),
      le = conts.length,
      ifr = null;

    for (var i = 0; i < le; i++) {
      if (conts[i].nodeType == 8) ifr = conts[i].textContent;
    }

    elm.addClass("player").html(ifr);
    elm.off("click");
  });
});

</script>
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda