jquery ui resiable- How to force to resize within the parent?
There are three columns in a web page that are resizable. I need to
- Force the columns width not to be more than the width of the parent
- They all together must fill the width of the parent
- Only the internal borders must be movable.
So if one column width is getting bigger, the other one must get smaller and vice versa.
To do so I need to I tried the jquery ui resiable
and set the containment: "parent"
but none of the 3 items are done. This is the code
<style>
.resizable
height: 300px;
border: 1px solid red;
float: left;
min-width: 20%;
</style>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-12">
<div class="card">
<div class="card-header text-right"> __('Messages') </div>
<div class="card-body ">
<div id="usersColumn" class="resizable">
</div>
<div id="messagesColumn" class="resizable"></div>
<div id="messageColumn" class="resizable"></div>
</div>
</div>
</div>
</div>
</div>
<script>
$(function ()
$(".resizable").resizable(
containment: "parent",
);
);
</script>
What shall I do?
Thanks
jquery css jquery-ui
add a comment |
There are three columns in a web page that are resizable. I need to
- Force the columns width not to be more than the width of the parent
- They all together must fill the width of the parent
- Only the internal borders must be movable.
So if one column width is getting bigger, the other one must get smaller and vice versa.
To do so I need to I tried the jquery ui resiable
and set the containment: "parent"
but none of the 3 items are done. This is the code
<style>
.resizable
height: 300px;
border: 1px solid red;
float: left;
min-width: 20%;
</style>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-12">
<div class="card">
<div class="card-header text-right"> __('Messages') </div>
<div class="card-body ">
<div id="usersColumn" class="resizable">
</div>
<div id="messagesColumn" class="resizable"></div>
<div id="messageColumn" class="resizable"></div>
</div>
</div>
</div>
</div>
</div>
<script>
$(function ()
$(".resizable").resizable(
containment: "parent",
);
);
</script>
What shall I do?
Thanks
jquery css jquery-ui
add a comment |
There are three columns in a web page that are resizable. I need to
- Force the columns width not to be more than the width of the parent
- They all together must fill the width of the parent
- Only the internal borders must be movable.
So if one column width is getting bigger, the other one must get smaller and vice versa.
To do so I need to I tried the jquery ui resiable
and set the containment: "parent"
but none of the 3 items are done. This is the code
<style>
.resizable
height: 300px;
border: 1px solid red;
float: left;
min-width: 20%;
</style>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-12">
<div class="card">
<div class="card-header text-right"> __('Messages') </div>
<div class="card-body ">
<div id="usersColumn" class="resizable">
</div>
<div id="messagesColumn" class="resizable"></div>
<div id="messageColumn" class="resizable"></div>
</div>
</div>
</div>
</div>
</div>
<script>
$(function ()
$(".resizable").resizable(
containment: "parent",
);
);
</script>
What shall I do?
Thanks
jquery css jquery-ui
There are three columns in a web page that are resizable. I need to
- Force the columns width not to be more than the width of the parent
- They all together must fill the width of the parent
- Only the internal borders must be movable.
So if one column width is getting bigger, the other one must get smaller and vice versa.
To do so I need to I tried the jquery ui resiable
and set the containment: "parent"
but none of the 3 items are done. This is the code
<style>
.resizable
height: 300px;
border: 1px solid red;
float: left;
min-width: 20%;
</style>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-12">
<div class="card">
<div class="card-header text-right"> __('Messages') </div>
<div class="card-body ">
<div id="usersColumn" class="resizable">
</div>
<div id="messagesColumn" class="resizable"></div>
<div id="messageColumn" class="resizable"></div>
</div>
</div>
</div>
</div>
</div>
<script>
$(function ()
$(".resizable").resizable(
containment: "parent",
);
);
</script>
What shall I do?
Thanks
jquery css jquery-ui
jquery css jquery-ui
asked Nov 13 '18 at 11:09
No oneNo one
6721031
6721031
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You need to:
Use the containment option to specify a parent DOM element or a jQuery selector
jquery UI - resizable
$(function()
$(".resizable").resizable(
containment: ".card-body"
);
);
.card-body
display: flex;
.resizable
height: 300px;
border: 1px solid red;
flex: 1 1 auto;
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-12">
<div class="card">
<div class="card-header text-right"> __('Messages') </div>
<div class="card-body ">
<div id="usersColumn" class="resizable">
</div>
<div id="messagesColumn" class="resizable"></div>
<div id="messageColumn" class="resizable"></div>
</div>
</div>
</div>
</div>
</div>
It is good, but here is problem, moving the right middle border causes movement of middle left border. It is not good at all. If I name the columns as(1,2,3)
, moving2
border to right must causes reducing3
width and increasing2
with. But it reduces1
width as well.
– No one
Nov 13 '18 at 11:45
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53279702%2fjquery-ui-resiable-how-to-force-to-resize-within-the-parent%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You need to:
Use the containment option to specify a parent DOM element or a jQuery selector
jquery UI - resizable
$(function()
$(".resizable").resizable(
containment: ".card-body"
);
);
.card-body
display: flex;
.resizable
height: 300px;
border: 1px solid red;
flex: 1 1 auto;
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-12">
<div class="card">
<div class="card-header text-right"> __('Messages') </div>
<div class="card-body ">
<div id="usersColumn" class="resizable">
</div>
<div id="messagesColumn" class="resizable"></div>
<div id="messageColumn" class="resizable"></div>
</div>
</div>
</div>
</div>
</div>
It is good, but here is problem, moving the right middle border causes movement of middle left border. It is not good at all. If I name the columns as(1,2,3)
, moving2
border to right must causes reducing3
width and increasing2
with. But it reduces1
width as well.
– No one
Nov 13 '18 at 11:45
add a comment |
You need to:
Use the containment option to specify a parent DOM element or a jQuery selector
jquery UI - resizable
$(function()
$(".resizable").resizable(
containment: ".card-body"
);
);
.card-body
display: flex;
.resizable
height: 300px;
border: 1px solid red;
flex: 1 1 auto;
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-12">
<div class="card">
<div class="card-header text-right"> __('Messages') </div>
<div class="card-body ">
<div id="usersColumn" class="resizable">
</div>
<div id="messagesColumn" class="resizable"></div>
<div id="messageColumn" class="resizable"></div>
</div>
</div>
</div>
</div>
</div>
It is good, but here is problem, moving the right middle border causes movement of middle left border. It is not good at all. If I name the columns as(1,2,3)
, moving2
border to right must causes reducing3
width and increasing2
with. But it reduces1
width as well.
– No one
Nov 13 '18 at 11:45
add a comment |
You need to:
Use the containment option to specify a parent DOM element or a jQuery selector
jquery UI - resizable
$(function()
$(".resizable").resizable(
containment: ".card-body"
);
);
.card-body
display: flex;
.resizable
height: 300px;
border: 1px solid red;
flex: 1 1 auto;
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-12">
<div class="card">
<div class="card-header text-right"> __('Messages') </div>
<div class="card-body ">
<div id="usersColumn" class="resizable">
</div>
<div id="messagesColumn" class="resizable"></div>
<div id="messageColumn" class="resizable"></div>
</div>
</div>
</div>
</div>
</div>
You need to:
Use the containment option to specify a parent DOM element or a jQuery selector
jquery UI - resizable
$(function()
$(".resizable").resizable(
containment: ".card-body"
);
);
.card-body
display: flex;
.resizable
height: 300px;
border: 1px solid red;
flex: 1 1 auto;
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-12">
<div class="card">
<div class="card-header text-right"> __('Messages') </div>
<div class="card-body ">
<div id="usersColumn" class="resizable">
</div>
<div id="messagesColumn" class="resizable"></div>
<div id="messageColumn" class="resizable"></div>
</div>
</div>
</div>
</div>
</div>
$(function()
$(".resizable").resizable(
containment: ".card-body"
);
);
.card-body
display: flex;
.resizable
height: 300px;
border: 1px solid red;
flex: 1 1 auto;
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-12">
<div class="card">
<div class="card-header text-right"> __('Messages') </div>
<div class="card-body ">
<div id="usersColumn" class="resizable">
</div>
<div id="messagesColumn" class="resizable"></div>
<div id="messageColumn" class="resizable"></div>
</div>
</div>
</div>
</div>
</div>
$(function()
$(".resizable").resizable(
containment: ".card-body"
);
);
.card-body
display: flex;
.resizable
height: 300px;
border: 1px solid red;
flex: 1 1 auto;
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-12">
<div class="card">
<div class="card-header text-right"> __('Messages') </div>
<div class="card-body ">
<div id="usersColumn" class="resizable">
</div>
<div id="messagesColumn" class="resizable"></div>
<div id="messageColumn" class="resizable"></div>
</div>
</div>
</div>
</div>
</div>
answered Nov 13 '18 at 11:23
ksavksav
5,30921331
5,30921331
It is good, but here is problem, moving the right middle border causes movement of middle left border. It is not good at all. If I name the columns as(1,2,3)
, moving2
border to right must causes reducing3
width and increasing2
with. But it reduces1
width as well.
– No one
Nov 13 '18 at 11:45
add a comment |
It is good, but here is problem, moving the right middle border causes movement of middle left border. It is not good at all. If I name the columns as(1,2,3)
, moving2
border to right must causes reducing3
width and increasing2
with. But it reduces1
width as well.
– No one
Nov 13 '18 at 11:45
It is good, but here is problem, moving the right middle border causes movement of middle left border. It is not good at all. If I name the columns as
(1,2,3)
, moving 2
border to right must causes reducing 3
width and increasing 2
with. But it reduces 1
width as well.– No one
Nov 13 '18 at 11:45
It is good, but here is problem, moving the right middle border causes movement of middle left border. It is not good at all. If I name the columns as
(1,2,3)
, moving 2
border to right must causes reducing 3
width and increasing 2
with. But it reduces 1
width as well.– No one
Nov 13 '18 at 11:45
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53279702%2fjquery-ui-resiable-how-to-force-to-resize-within-the-parent%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown