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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:25:21+00:00 2026-05-16T18:25:21+00:00

1) We have <body> , it’s height and width varies (different resolutions). 2) Many

  • 0

1) We have <body>, it’s height and width varies (different resolutions).

2) Many blocks with images inside it, can be more than 50 blocks.

3) width and height are equal for each block.

How can we fill the body with all available images, that can be visible on current resolution, and hide others?

There should be no horizontal/vertical scrollbars.

For example, we have 50 blocks inside <body>. 1024×768 can accommodate only 20, so we show them and hide others. If person changes browser window size to 1280 – we show more blocks and so on.

Actually I don’t ask you to write the full script. I need the links on some similar scripts that are already work.

Its better if blocks can change themselves (like slideshow).

Thanks.

  • 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-16T18:25:22+00:00Added an answer on May 16, 2026 at 6:25 pm

    I’m trying to figure out an algorithm:

    1) get the width of container containing the blocks (container should be relative, so that it expands when you resize the window). To get the width use .width or .outerWidth

    2) divide the width of the container by the block’s width, floor it. Now you know how many blocks fit in one row.

    3) To calculate the height, this can be tricky because you may have a header or navigation etc. which cuts the vertical space down. So do this:

    3.1) Get the height of the window $(window).height();

    3.2) Get the container’s top offset $('#container').offset().top

    3.3) Subtract the offset from the window height – now you have the “real” height available
    (note: if you have a footer etc. you have to subtract this reserverd space, too)

    4) Divide the real available vertical space through the block’s height (spend attention on margins/paddings) and floor this number. Now you know how many rows may fit in your space.

    5) multiply max. rows and max. columns we’ve calculated, that’s the maximum amount of blocks that fit in.

    6) Get your blocks like $('.block') and iterate thru it $('.block').each(function(index) { ... }); now if the index is bigger than the max. number of blocks we’ve calculated, hide them!

    7) Attach an event handler to $(window).resize(function() { }) and do the steps above on resize

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

Sidebar

Related Questions

Does anyone have any suggestions as to how I can clean the body of
I have a body of text that I have to scan and each line
In a stylesheet i have: * HTML BODY { padding-right: 0px; padding-left: 0px; padding-bottom:
Note that this function does not have a { and } body. Just a
I have a series of divs in a pattern of header/body, where a click
Suppose I have the following CSS rule in my page: body { font-family: Calibri,
I have a requirement of reading subject, sender address and message body of new
I have one interesting problem. I must parse mail body (regular expression), get some
For example: This is main body of my content. I have a footnote link
I have an email subject of the form: =?utf-8?B?T3.....?= The body of the email

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.