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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:28:58+00:00 2026-05-27T15:28:58+00:00

First question. Hope this isn’t a repeat. I have an unordered list of thumbnails

  • 0

First question. Hope this isn’t a repeat.

I have an unordered list of thumbnails displayed as inline-blocks. The images all line up in a nice, clean grid. But, depending on the size of their wrapper, the number of columns and rows can vary. I have data that will pop up over the image on hover (with a delay). The data is displayed below and to the right of the thumbnail. But this means the data can show up off the page if the image is on the far right.
I was wondering if there is a way of determining the row or column number via jquery, so I could make elements at either end display the details properly.

If there isn’t, I was thinking that I could get the outer width of my list elements with their margin and the inner width of the wrapper. I’d divide the wrapper by the list element, and I would then get the maximum number of list elements per row! Then I could find elements on the edge of a row through various means of javascript magic. However, this does not always work.

For instance, my previous test had 150px square thumbnails with a 2px margin. The interior width of the wrapper was 937. 937 / 154 = 6.0844. Those are numbers straight out of jquery, by the way. However, the rows were rendered with 5 columns. Dropping my margin to 1 so that my widths were 152px allowed me to get 6 images per row (6.164). I could very well work on a plugin for my goal as it is, but this little quirk bothered me.

Any ideas or recommendations?

By the way, this was tested in Chrome and Firefox.

  • 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-27T15:28:59+00:00Added an answer on May 27, 2026 at 3:28 pm

    I guess I can’t comment without at least 50 rep… So I’ll just post here.

    As +Kevin B said, and who i agree with, one possible solution is to find the position of the obj that is the parent for the popup. Compare that position to the width of the page and if it’s smaller than the width of your popup move the popup further to the left to compensate. Example:

    <style>
    #parent { width: 200px; float:right }
    #popup { width: 100px; }
    </style>
    
    <script>
        $(document).ready(function () {
            var parentRight = $("#parent").position().right;
            var windowRight = $(window).width();
    
            var width = windowRight - parentRight;
            if ($("#popup").width() < width) {
                //display popup
            }
            else {
                var offset = $("#popup").width() - width;
                var newLeft = $("#popup").position().left - offset;
                //display popup
                $("#popup").css('left', newLeft);
            }
        });
    </script>
    
    <div id="popup" />
    <div id="parent" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a question about Excel! I hope that isn't too unconventional for this
this is my first question here so I hope I can articulate it well
This is my first time here so I hope I post this question at
Since this is my first question here on stackoverflow I hope my question is
this my first question on here. I hope someone can help. It is to
I'm still a newcomer to python, so I hope this question isn't inane. The
This is my first question to SO, I hope to get it right. In
This is my first question, so I tried to be clear (hope its not
This is my first question here on stackoverflow, so I hope that I am
This is actually my very first question on Stackoverflow. I hope its not the

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.