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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:15:36+00:00 2026-06-16T00:15:36+00:00

I have many div s distributed in rows and columns, (generated using jQuery). Each

  • 0

I have many divs distributed in rows and columns, (generated using jQuery). Each one of these divs is re-sizable, using JQuery UI Resizable. In order to define the requirements, all divs must use absolute positioning. So, when I re-size any of these divs, the script should update the top attribute of all divs below this, (located in the same column and one row after the current resizing div).

This is the code I have now:

updatePositions: function() {
        var update = 0;
        $(".element").resizable({
            handles: 's',
            start: function(event, ui) {
                event.stopPropagation();
                var el = $(this);
                var el_row = parseInt(el.attr("row"));
                var el_rel = parseInt(el.attr("rel"));
                var el_col = parseInt(el.attr("col"));
                update = $(".element").filter(function() {
                    return(
                        $(this).attr("row") > el_row &&
                        $(this).attr("col") == el_col &&
                        $(this).attr("rel") != el_rel
                    );
                    });
            },
            resize: function(event, ui) {
                update.each(function(event){
                    var top = $(this).position().top + $(this).height() + 20;
                    $(this).css("top", top )
                });
            }
        })
    }

And here is an example: JSFiddle

As you can see, all the divs are found just right and I can update the top position. But for some reason it’s getting crazy when resizing! It seems like I’m doing the update as many times as found tiles on each selected div.

  • 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-16T00:15:37+00:00Added an answer on June 16, 2026 at 12:15 am

    finally I solved this problem. JSFiddle

    this is the js code:

    function CacheType(){
        corrtop = 0;
        rel = 0;
    }
    
    $.extend({
        updatePositions: function() {
            var update = 0;
            var arr = new Array();
            $(".element").resizable({
                handles: 's',
                start: function(event, ui) {
                    event.stopPropagation();
                    var el = $(this);
                    var el_row = parseInt(el.attr("row"));
                    var el_rel = parseInt(el.attr("rel"));
                    var el_col = parseInt(el.attr("col"));
                    var ex = el.position().top;
                    var ey = el.height();
                    update = $(".element").filter(function() {
                        if(
                            $(this).attr("row") > el_row &&
                            $(this).attr("col") == el_col &&
                            $(this).attr("rel") != el_rel
                        ){
                            var tmp = new CacheType();
                            tmp.corrtop = $(this).position().top - ex - ey;
                            tmp.rel = $(this).attr('rel');
                            arr.push(tmp);
                            return true;
                        }else{
                            return false;
                        }
                        });
                },
                resize: function(event, ui) {
                    var x = $(this).height() + $(this).position().top;
                    update.each(function(event){
                        for(var i=0;i<arr.length; i++){
                            var tmp = arr[i];
                            var rel = $(this).attr('rel');
                            if(rel == tmp.rel)
                                $(this).css("top", x + tmp.corrtop);
                        }
                    });
                }
            })
        }
    });
    $(document).ready(function(){
        $.updatePositions();
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have divided the screen with many div so they stick one to each
I have a DIV with many elements that are all clickable. Each one with
I have many div.image , each one has a huge size. How do I
I want to append a div inside a div which have many divs inside
I have many divs <div id=movies rel=info.php?m=19923></div> <div id=movies rel=info.php?m=98127></div> <div id=movies rel=info.php?m=39423></div> <div
I have many lines on my page generated from database with PHP. Each line
I am using galleria jquery plugin. I have a div with class carousel, This
I have a page which loads divs of rounded corners. And on each div
I have many inputs in a few divs, every div is being hidden and
I have many DIVs, let's say 100, split by categories like that : <div

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.