Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

143
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!