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
By modifying the code jQuery uses to implement the
alsoResizeoption, we can make our ownalsoResizeReverseoption. Then we can simply use this as follows:The structure of the original
alsoResizeoption 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
alsoResizetoalsoResizeReverseand subtracting thedeltainstead of adding it (what makes the resize reversed). The originalalsoResizecode 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
alsoResizeReversefunctionality, 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):
For older version (based on v1.8.1 — my original answer):
Here’s a demo: http://jsfiddle.net/WpgzZ/