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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:56:55+00:00 2026-06-12T10:56:55+00:00

Here is what I want to do: I’m using gridster in order to create

  • 0

Here is what I want to do: I’m using gridster in order to create a form creation IDE. The user drags elements in the grid, and can move them around.

Everything works great inside the editor, but when I try to use those forms but I’m having issues when the elements inside the grid positions become bigger than the grid block that contains them, making one element overlapping another.

What I’m looking for is an automated solution that when given a bunch of absolute positioned elements, it moves them up or down so they don’t overlap. Does such thing exist?

  • 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-12T10:56:56+00:00Added an answer on June 12, 2026 at 10:56 am

    I made a workaround myself

    I wrote this code, and put it inside an interval that loops all the time, making the elements that belong to the same column not overlapping.

    Take note that the .gs_w is the class of the gridster grid cell which contains the .form_row which in turn contains the input element itself and shrinks to fit it.

    Finally this won’t work if dragging is enabled, which in my case is ok because only the form editor I built utilises dragging. Not the forms themselves.

    setInterval(collision_checks);
    
    /**
     * Handles vertical collisions of gridster elements
     */
    function collision_checks()
    {
        var elements = $('.gs_w');
        if(!$(elements).length)
        {
            return;
        }
    
        var columns = {};
        // Group the elements in columns
        $(elements).each(function(){
            //If an element takes more than one columns, add it in all of them
            //so collision gets handled properly
            for(var i = 0; i < $(this).data('sizex'); i++)
            {
                columns[parseInt($(this).data('col'), 10) + i] = columns[parseInt($(this).data('col'), 10) + i] || [];
                columns[parseInt($(this).data('col'), 10) + i].push(this);
            }
    
        });
    
        // For each column, handle if it's elements collides with the element below it
        for(var i in columns)
        {
            if(!columns.hasOwnProperty(i)){continue;}
            var column = columns[i];
            for(var j in column)
            {
                if(!column.hasOwnProperty(j)){continue;}
                var element = column[j];
                var element_below = column[parseInt(j,10) + 1];
    
                if(!$(element).is(':visible'))
                {
                    continue;
                }
    
                if(element == element_below)
                {
                    continue;
                }
    
                var depth = penetration_depth(element, element_below);
                if(depth)
                {
                    var offset = $(element_below).position();
                    $(element_below).css('top', offset.top + depth);
                }
            }
        }
    }
    
    
    /**
     * if the top element overlaps the bottom one, this function returns their penetration depth
     */
    function penetration_depth(el_top, el_bottom)
    {
        if(!el_bottom){return 0;}
        if($(el_top).find('.form_row').offset().top + $(el_top).find('.form_row').outerHeight(true) > $(el_bottom).find('.form_row').offset().top)
        {
            return $(el_top).find('.form_row').offset().top + $(el_top).find('.form_row').outerHeight(true) - $(el_bottom).find('.form_row').offset().top;
        }
        else
        {
            return 0;
        }
    }
    

    Any suggestions or improvements are welcome!

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

Sidebar

Related Questions

Essentially here I want the modal form sheet to be transparent so I can
I'm not entirely sure if I can do what I want here, but I
Here i want to developed one application using google account login facility and i
I want to read a file using shell script and here want to calculate
here i want to encrypt and decrypt files using AES 256 Algorithm than i
I am using the jquerymobile for developing app. Here I want to move the
I want to create an Curve layout like Sen want here How to create
I feel like I'm using Ruby the wrong way here: I want to generate
i create one simple apps.here i want use the one already create apps (name
Here i want to create dynamically memory. here i dnt know the output size

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.