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 8862231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:40:45+00:00 2026-06-14T15:40:45+00:00

I have a containing element that is set to overflow hidden with a UL

  • 0

I have a containing element that is set to overflow hidden with a UL that overflows the container. How would I go about getting the li’s that are visible?

My markup:

<div class="dm-similar-photos-content-container">
    <ul class="carousel" style="left: 0px;">
        <li class="dm-image">
            <img data-photoid="1" src="http://lorempixel.com/150/150/food/1">
        </li>

        <li class="dm-image">
            <img data-photoid="2" src="http://lorempixel.com/150/150/food/2">
        </li>

        <li class="dm-image">
            <img data-photoid="3" src="http://lorempixel.com/150/150/food/3">
        </li>

        <li class="dm-image">
            <img data-photoid="4" src="http://lorempixel.com/150/150/food/4">
        </li>

        <li class="dm-image">
            <img data-photoid="5" src="http://lorempixel.com/150/150/food/5">
        </li>

        <li class="dm-image">
            <img data-photoid="6" src="http://lorempixel.com/150/150/food/6">
        </li>

        <li class="dm-image">
            <img data-photoid="7" src="http://lorempixel.com/150/150/food/7">
        </li>

        <li class="dm-image">
            <img data-photoid="8" src="http://lorempixel.com/150/150/food/8">
        </li>

        <li class="dm-image">
            <img data-photoid="9" src="http://lorempixel.com/150/150/food/9">
        </li>

        <li class="dm-image">
            <img data-photoid="10" src="http://lorempixel.com/150/150/food/10">
        </li>

    </ul>
</div>


<div>
    <a class="left">
        <- Left
    </a>
    <a class="right">
        Right ->        
    </a>    
</div>

My Styles:

.dm-similar-photos-content-container {
    margin: 0 30px;
    overflow: hidden;
    width: 335px;
}
.carousel {
    margin: 0;
    padding: 0;
    position: relative;
    width: 9999px;
}
.dm-similar-photos-content-container .dm-image {
    margin: 13px 27px 13px 0;
}

.dm-image {
    float: left;
    list-style: none outside none;
    margin: 16px 16px 0 0;
    position: relative;
}


.dm-image img {
    border: 2px solid #7F8886;
}

and finally the simple left and right JS:

jQuery('.left').on('click', function() {
    jQuery(".carousel").animate({
        left: "-=181"
    });
});

jQuery('.right').on('click', function() {
    jQuery(".carousel").animate({
        left: "+=181"
    });
});

You can see it here: http://jsfiddle.net/GGhUF/

  • 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-06-14T15:40:46+00:00Added an answer on June 14, 2026 at 3:40 pm

    There general approach is to figure out whether the element lies within the bounding box of its parent, which can be figured out using their respective widths and offsets. The best way to incorporate all this is in a single custom selector:

    jQuery.extend(jQuery.expr[':'], {
        inparent: function(el) {
            parent = $(el).parent();
            if ($(el).offset().top >= parent.offset().top && 
                $(el).offset().top + $(el).outerHeight(true) <= parent.offset().top + parent.outerHeight(true) && 
                $(el).offset().left >= parent.offset().left && 
                $(el).offset().left + $(el).outerWidth(true) <= parent.offset().left + parent.outerWidth(true)) 
            {
                return true;
            }
            return false;
        }
    });
    

    You can then use it like this:

    var visibleli = $('li:inparent');
    

    This could obviously benefit from some optimisation (early exit after comparing widths etc.), but I’ll let you work that out.

    Here’s a demonstration: http://jsfiddle.net/DDRYj/

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

Sidebar

Related Questions

How do I center an element of unknown width containing elements that have display:
I have a div element containing some text. When the user clicks a word
I have a containing div that is constrained in its height and width. It
I have a header that contains three inline-blocks. The element containing these blocks is
I have a select element containing different titles; as an example: <select name=titles> <option
I have seen XML Schema element with attributes containing only text but I have
I have a singly-linked list containing 1 value in each element. struct listElement {
Hey I have an array where each element is a hash containing a few
I have an element containing a RectangleGeometry. this is in a UserControl later used
I want to append an html element to a div and have jquery return

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.