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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:21:32+00:00 2026-06-10T17:21:32+00:00

I would like to find a way to dynamically adjust the number of modules

  • 0

I would like to find a way to dynamically adjust the number of modules based on main-content height. Is it possible and how ? in css ? javascript ?

The purpose is to avoid having blank page if there is no content.

Thanks in advance

Vanessa

  • 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-10T17:21:34+00:00Added an answer on June 10, 2026 at 5:21 pm

    This could be accomplished in many ways, some more elegant than others.
    The most simple one I could think of is to use Javascript only:

    1. All module content is sent in the HTML. (as now)
    2. Get the height of the main content.
    3. While the main content is higher than the modules height, remove the last module.

    Something like: (Code not tested)

    window.addEvent('domready', function() {
        // Get heigth of main content
        var contentHeight = document.id('content').getHeight();
    
    // While the height of the main content is more than 200
    // and less than the height of the modules
        while(contentHeight > 200 && contentHeight < document.id('modules').getHeight()) {
            // Get the last module and remove it.
            $$('#modules .moduletable').getLast().dispose();
        }
    });
    

    Note that this assumes you are using mootools (which is probably already provided by your Joomla installation). Also, my element selectors may not work with your template.

    Again, the server will still send all modules even if some are to be removed. Another thing is that this will start when the DOM of your webpage has been fully loaded, meaning the user might see modules disappearing. Therefore it could also be nicer to hide all the modules at the start and then use a similar loop to display the modules one by one.

    EDIT:
    Another sample you may prefer.

    window.addEvent('domready', function() {
        // Get heigth of main content
        var contentHeight = document.id('gkContent').getHeight();
    
        // While the height of the modules is more than 500
        // and less than the height of the modules
        while(document.id('gkRight').getHeight() > 500 && contentHeight < document.id('gkRight').getHeight()) {
            // Get the last module and remove it.
            var banners = $$('#gkRight .adsense2, #gkRight .bannergroup');
            if(banners.length > 0) banners.getLast().dispose();
            else break;
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to find a way to store multiple addresses for one subject
I would like to find a way to see what happens while my XAML
I would like to find a way to compile and package our iPhone application
I would like to find a way to use custom User provider within a
I would like to know if there is any way to find the actual
I would like to know if there's a way in java to find out
I would like to find a way to have a Dictionary of various Mock
I would like to find the distance of every pixel coordinate in an image
I would like to find out which version of an executable the CMD shell
I would like to find out is as3 is doing is doing anything in

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.