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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T02:00:06+00:00 2026-05-16T02:00:06+00:00

How to make the jQuery UI Resizable alsoResize reverse direction. suppose in the html

  • 0

How to make the jQuery UI Resizable alsoResize reverse direction.

suppose in the html there is two div tag is there, if i resize in upward means the other thing has to resize downward

<script>
        $(function() {
        $("#resizable").resizable({alsoResize: ".myiframe"});

    });
</script>
<div id = "resizable">
        This is the resizable content...
</div>

<div class="myframe">
   This must resize in reverse direction...
</div>

i tried it but of no use please guide to solve this

  • 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-16T02:00:07+00:00Added an answer on May 16, 2026 at 2:00 am

    By modifying the code jQuery uses to implement the alsoResize option, we can make our own alsoResizeReverse option. Then we can simply use this as follows:

    $("#resizable").resizable({
        alsoResizeReverse: ".myframe"
    });
    

    The structure of the original alsoResize option has been changed over the various versions of jQuery UI and my original code does not work in the newer versions. I’ll give the code for adding this functionality in version 1.8.1 and 1.11.4.

    Only a few things had to be changed, such as the obvious renaming alsoResize to alsoResizeReverse and subtracting the delta instead of adding it (what makes the resize reversed). The original alsoResize code starts on line 2200 of version 1.8.1 of jQuery UI and line 7922 of version 1.11.4. You can see the few changes needed here.

    To add the alsoResizeReverse functionality, add this to your javascript (This should be put outside of document.ready()):

    For newer versions of jQuery UI (example is based on v1.11.4):

    $.ui.plugin.add("resizable", "alsoResizeReverse", {
    
        start: function() {
            var that = $(this).resizable( "instance" ),
                o = that.options;
    
            $(o.alsoResizeReverse).each(function() {
                var el = $(this);
                el.data("ui-resizable-alsoresizeReverse", {
                    width: parseInt(el.width(), 10), height: parseInt(el.height(), 10),
                    left: parseInt(el.css("left"), 10), top: parseInt(el.css("top"), 10)
                });
            });
        },
    
        resize: function(event, ui) {
            var that = $(this).resizable( "instance" ),
                o = that.options,
                os = that.originalSize,
                op = that.originalPosition,
                delta = {
                    height: (that.size.height - os.height) || 0,
                    width: (that.size.width - os.width) || 0,
                    top: (that.position.top - op.top) || 0,
                    left: (that.position.left - op.left) || 0
                };
    
            $(o.alsoResizeReverse).each(function() {
                var el = $(this), start = $(this).data("ui-resizable-alsoresize-reverse"), style = {},
                    css = el.parents(ui.originalElement[0]).length ?
                        [ "width", "height" ] :
                        [ "width", "height", "top", "left" ];
    
                $.each(css, function(i, prop) {
                    var sum = (start[prop] || 0) - (delta[prop] || 0);
                    if (sum && sum >= 0) {
                        style[prop] = sum || null;
                    }
                });
    
                el.css(style);
            });
        },
    
        stop: function() {
            $(this).removeData("resizable-alsoresize-reverse");
        }
    });
    

    For older version (based on v1.8.1 — my original answer):

    $.ui.plugin.add("resizable", "alsoResizeReverse", {
    
        start: function(event, ui) {
    
            var self = $(this).data("resizable"), o = self.options;
    
            var _store = function(exp) {
                $(exp).each(function() {
                    $(this).data("resizable-alsoresize-reverse", {
                        width: parseInt($(this).width(), 10), height: parseInt($(this).height(), 10),
                        left: parseInt($(this).css('left'), 10), top: parseInt($(this).css('top'), 10)
                    });
                });
            };
    
            if (typeof(o.alsoResizeReverse) == 'object' && !o.alsoResizeReverse.parentNode) {
                if (o.alsoResizeReverse.length) { o.alsoResize = o.alsoResizeReverse[0];    _store(o.alsoResizeReverse); }
                else { $.each(o.alsoResizeReverse, function(exp, c) { _store(exp); }); }
            }else{
                _store(o.alsoResizeReverse);
            }
        },
    
        resize: function(event, ui){
            var self = $(this).data("resizable"), o = self.options, os = self.originalSize, op = self.originalPosition;
    
            var delta = {
                height: (self.size.height - os.height) || 0, width: (self.size.width - os.width) || 0,
                top: (self.position.top - op.top) || 0, left: (self.position.left - op.left) || 0
            },
    
            _alsoResizeReverse = function(exp, c) {
                $(exp).each(function() {
                    var el = $(this), start = $(this).data("resizable-alsoresize-reverse"), style = {}, css = c && c.length ? c : ['width', 'height', 'top', 'left'];
    
                    $.each(css || ['width', 'height', 'top', 'left'], function(i, prop) {
                        var sum = (start[prop]||0) - (delta[prop]||0); // subtracting instead of adding
                        if (sum && sum >= 0)
                            style[prop] = sum || null;
                    });
    
                    //Opera fixing relative position
                    if (/relative/.test(el.css('position')) && $.browser.opera) {
                        self._revertToRelativePosition = true;
                        el.css({ position: 'absolute', top: 'auto', left: 'auto' });
                    }
    
                    el.css(style);
                });
            };
    
            if (typeof(o.alsoResizeReverse) == 'object' && !o.alsoResizeReverse.nodeType) {
                $.each(o.alsoResizeReverse, function(exp, c) { _alsoResizeReverse(exp, c); });
            }else{
                _alsoResizeReverse(o.alsoResizeReverse);
            }
        },
    
        stop: function(event, ui){
            var self = $(this).data("resizable");
    
            //Opera fixing relative position
            if (self._revertToRelativePosition && $.browser.opera) {
                self._revertToRelativePosition = false;
                el.css({ position: 'relative' });
            }
    
            $(this).removeData("resizable-alsoresize-reverse");
        }
    });
    

    Here’s a demo: http://jsfiddle.net/WpgzZ/

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

Sidebar

Related Questions

Does anybody know how to make the jQuery dialog non-resizable ? At the moment,
I'd like to make a textarea resizable. I tried out jQuery UI's resizable functionality,
I have a 'toolbar' div that I made resizable via jQuery UI. The weird
I would like to know how to make resizable image with jQuery on the
I have a click function setup to make a div resizable. When I click
How do I make one jquery ui slider control another? If I slide slider
I am using jQuery to make an AJAX request to a remote endpoint. That
I am using jQuery to make some ajax calls and wonder how people handle
I am using .Net framework 2.0 / jQuery to make an Ajax call to
I am using the $.ajax function in jquery to make a call to an

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.