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

145
Visualizações
Detect if OverlayScrollbars element is scrollable

I am using OverlayScrollbars to make a div scrollable. On page load, I'm trying to detect if the div content has overflowed the container div or not. This is so that I can apply some additional styling to the container if the content has overflowed.

This is the code I have for initialising the scroll bars:

        $("#entries").overlayScrollbars({
            scrollbars: {
                visibility: "auto",
                autoHide: "move",
            },
            callbacks: {
                onScroll: function (event) {
                    scrollBarOverlays();
                }
            }
        });

I have then tried to use .getState() to see the hasOverflow value - but on page load this returns empty values. It only shows values once the content has been scrolled.

https://kingsora.github.io/OverlayScrollbars/#!documentation/method-getstate

Any help appreciated!

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

IF anyone else is struggling with this, I managed to solve it using onOverflowChanged callback.

       $("#entries").overlayScrollbars({
            scrollbars: {
                visibility: "auto",
                autoHide: "move",
            },
            callbacks: {
                onScroll: function (event) {
                    scrollBarOverlays();
                },
                onOverflowChanged : function(eventArgs) {
                    if(eventArgs.yScrollable==true){
                        $("#entries").addClass("bottom-gradient-box");
                    } else {
                        $("#entries").removeClass("bottom-gradient-box");
                    }
                }
            }
        });
about 4 years ago · Juan Pablo Isaza Relatório
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