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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:58:50+00:00 2026-05-26T17:58:50+00:00

I have a resizable div which is positioned over a selection of elements which

  • 0

I have a resizable div which is positioned over a selection of elements which have been set to alsoResize.

Visually, the resizable element is a bounding box for the alsoResize elements.

I want to be able to resize the alsoResize elements in proportion of the resizable div. UI’s default behaviour makes each element have a fixed left and top position when resizing:

http://jsfiddle.net/digitaloutback/SrPhA/2/

But I want to adjust the left and top of each AR element to scale with the bounding box as it’s resized.

I first thought this wouldn’t be too much hassle by altering the alsoResize plugin. This is what I added to the resize: _alsoResize:

// Get the multipliers
var scaleX = self.size.width / os.width;
var scaleY = self.size.height / os.height;

newElW = ( parseInt(el.css('width')) * scaleX );
newElH = ( parseInt(el.css('height')) * scaleY );
newElL = ( parseInt(el.css('left')) * scaleX );
newElT = ( parseInt(el.css('top')) * scaleY );

el.css({ width: newElW, height: newElH, left: newElL, top: newElT });

As you’ll see, the boxes lag somewhat:

http://jsfiddle.net/digitaloutback/SrPhA/4/

Something seems to be ballooning the figures and can’t quite figure it out, any suggestions appreciated. Possibly discrepancy of decimal places between scripts & browser?

  • 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-26T17:58:51+00:00Added an answer on May 26, 2026 at 5:58 pm

    Maybe you need to rethink the structure..

    You could insert the .lyr elements inside the .resizer element and position them inside it with percentage positions .. this way they will automatically resize while their container is changing size. (the plugin does not have to handle them)

    demo at http://jsfiddle.net/SrPhA/65/


    Update after comment

    To de-couple the resizer from the alsoResize elements you will need to take a couple of things into consideration for the calculations.

    • Firstly, you need to use the starting dimensions/positions and not the current of the elements, so use start.width .height etc..
    • for the positioning you need to translate the element to the origin (in regards to distance from the resizer) scale the left/top and then re-translate back to where they were..

    the final calculations become

    newElW = start.width * scaleX;
    newElH = start.height * scaleY;
    newElL = ((start.left - op.left) * scaleX) + op.left;
    newElT = ((start.top  - op.top ) * scaleY) + op.top ;
    

    It needs some more tinkering to handle the case were you scale the elements by dragging the top or left side of the resizer..

    demo at http://jsfiddle.net/gaby/SrPhA/171/


    Latest Update

    to handle scaling in all directions use these helpers..

    utils: {
            west: function(start, op, scale, delta) {return ((start.left - op.left) * scale) + op.left + delta.left},
            east: function(start, op, scale, delta) {return ((start.left - op.left) * scale) + op.left;},
            south: function(start, op, scale, delta){return ((start.top  - op.top ) * scale) + op.top; },
            north: function(start, op, scale, delta){return ((start.top  - op.top ) * scale) + op.top + delta.top; }
        }
    

    Working example with all updates at http://jsfiddle.net/gaby/SrPhA/324/

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

Sidebar

Related Questions

I have a div element which is made jquery Resizable. It has alsoResize option
I have a web page which has three <div> elements: Right_bar contains several layouts
I have a resizable div which is using custom scrollbars of jScrollPane. I want
I have a click function setup to make a div resizable. When I click
I have a DIV container which position is absolute and I'm having a draggable
I have a div that is made resizable using jQuery UI. How can I
I have a div,which content some text content. <div id=con style=position:absolute;left:50px;top:50px;border:1px solid red;font-size:12px;> Text
I have a div that looks like <div class=draggable resizable abc table shadow></div> Clases
I have the following code which builds a JQueryUI Dialog popup. $j('<div></div>') .html(message) .dialog({
I am looking into the jQuery UI Resizable method and I have to DIVs

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.