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

151
Visualizações
Jquery scrollTop/scrollLeft works but not animate

I have a set sized iframe within a larger sized HTML document, which makes it so it has a scrollbar. There is another set of iframe just like the first one and I wanted to synchronise the scrolling on both document. I can get both #document, which has the scrollbar. So I can set the scroll event. The issue is I would like to use .animate, but when I do I get the following error.

> jquery-3.6.0.min.js:2 Uncaught TypeError: Cannot read properties of undefined (reading 'display')
>     at ae (jquery-3.6.0.min.js:2:44259)
>     at Object.S.Animation.S.extend.prefilters (jquery-3.6.0.min.js:2:73843)
>     at lt (jquery-3.6.0.min.js:2:73011)
>     at HTMLDocument.a (jquery-3.6.0.min.js:2:76247)
>     at Function.dequeue (jquery-3.6.0.min.js:2:42775)
>     at HTMLDocument.<anonymous> (jquery-3.6.0.min.js:2:43330)
>     at Function.each (jquery-3.6.0.min.js:2:3639)
>     at S.fn.init.each (jquery-3.6.0.min.js:2:1778)
>     at S.fn.init.queue (jquery-3.6.0.min.js:2:43217)
>     at S.fn.init.animate (jquery-3.6.0.min.js:2:76386)

First of all I do not understand what is missing and if .animate does not work why does .scrollTop() and .scrollLeft() work?

I use the following code to .animate and .scrollTop()/.scrollLeft()

htmlContentSrc.scroll(function (event) {
                if (previewLangPairMngr.onScrollBlocker && previewDisplayMngr.containerSync) {
                    previewLangPairMngr.onScrollBlocker = false;
                    htmlContentTrg.animate({
                        scrollTop: htmlContentSrc.scrollTop(),
                        scrollLeft: htmlContentSrc.scrollLeft()
                    }, 100, function () {
                            previewLangPairMngr.onScrollBlocker = true;
                    });
                }
            });
htmlContentSrc.scroll(function (event) {
                if (previewLangPairMngr.onScrollBlocker && previewDisplayMngr.containerSync) {
                    previewLangPairMngr.onScrollBlocker = false;
                    htmlContentTrg.scrollTop(htmlContentSrc.scrollTop());
                    htmlContentTrg.scrollLeft(htmlContentSrc.scrollLeft());
                    previewLangPairMngr.onScrollBlocker = true;
                }
            });
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