Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6980343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:00:15+00:00 2026-05-27T18:00:15+00:00

So the example mark-up: <div class=overflow> <ul> <li> <a href=#>1</a> </li> <li> <a href=#>2</a>

  • 0

So the example mark-up:

<div class="overflow">
    <ul>
        <li>
            <a href="#">1</a>
        </li>
        <li>
            <a href="#">2</a>
        </li>
        <li>
            <a href="#">3</a>
        </li>
    </ul>                                
</div>

The first li and the second li are visible to the user. The 3rd is too large to be displayed given the overflow: hidden. But as far as jQuery is concerned using:

$('.selected').is(':visible')

will always return true as it doesn’t have display: none etc.

CSS:

.overflow {
    overflow: hidden;
    width: auto;
    max-width: 490px;
}

Does anybody know how to detect if the element is visible from within the overflow hidden div?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T18:00:16+00:00Added an answer on May 27, 2026 at 6:00 pm

    You’ll need to compare the top of the <li> item to the scrollTop() of the overflow div.

    $('li').each(function(){
        oScrollTop = $('.overflow').scrollTop();
        var thisItemIsVisible = ($(this).position().top < oScrollTop);
        console.log('This LI is Visible: ' + thisItemIsVisible);
    });
    

    Note, this code assumes that if any part of the li is visible, the item is visible. You might want to take the li’s height into consideration also.

    EDIT

    If your overflow content is hidden, scrollTop will always be 0, so you should compare the LI’s top position to the height of the overflow div.

    Here is a working demo http://jsfiddle.net/qaGpm/. For the sake of demonstration, I changed the overflow from hidden to visible ….

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Assuming this mark-up: <html class=fr> <head> </head> <body> <div class=class1> </div> </body> </html> Will
Example I have Person , SpecialPerson , and User . Person and SpecialPerson are
Example: The user login to the webpage => Click on a button This action
We have many links with rel attributes: <div class=team-tags> <a class=s1 rel=t1 t2 t3
for example, when I ping mark.appspot.com and john.appspot.com, it returns the same IP, but
How to mark something as viewed when a user clicks on a row. Here
For example, if the user has JavaScript enabled, we send hash his password and
Given the example code below: // ExampleModel.h @interface ExampleModel : NSObject <ASIHTTPRequestDelegate> { }
My tool tip text doesn't wrap with given text in ie6, live example http://jsfiddle.net/hWAJh/
Example: You have a shortcut s to SomeProgram in the current directory. In cmd.exe

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.