[英]jQuery resizable issue if applied to child element of a resizable
Here is my complete code, which is derived from jQuery Resizable Example - 这是我的完整代码,它源自jQuery Resizable示例 -
In my example I have two div
elements, with id parent
and child
, where child
element is inside parent
element. 在我的例子,我有两个
div
元素,id为parent
和child
,其中child
元素在里面parent
元素。 My Problem is I am not able to resize parent
element, even I have made it resizable
. 我的问题是我无法调整
parent
元素的大小,即使我已经使它可以resizable
。 Has anyone faced the similar issue? 有没有人遇到类似的问题?
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Resizable - Default functionality</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<style>
#parent {
padding: 40px;
width:400px;
height:400px;
}
#child {
width: 150px;
height: 150px;
}
</style>
<script>
$(function() {
$( "#child" ).resizable();
$( "#parent" ).resizable();
});
</script>
</head>
<body>
<div id="parent" class="ui-widget-content">
<h3>Parent</h3>
<div id="child" class="ui-widget-content">
<h3>Child</h3>
</div>
</div>
</body>
</html>
NOTE 注意
Playing with the code, I just found out, this problem only occur is I make child
element reseizable before parent
element. 玩代码,我刚刚发现,这个问题只发生在我
parent
元素之前我可以重新设置child
元素。 As in code - 在代码中 -
$(function() {
$( "#child" ).resizable();
$( "#parent" ).resizable();
});
If I change the order to - 如果我将订单更改为 -
$(function() {
$( "#parent" ).resizable();
$( "#child" ).resizable();
});
it will work smoothly. 它会顺利运作。 I am not sure why it is happening.
我不确定为什么会这样。
I will try looking into jQuery resizable code but if someone already have faced and solve this issue it will be very helpful. 我将尝试查看jQuery可调整大小的代码,但如果有人已经面对并解决了这个问题,那将非常有帮助。
-Thanks -谢谢
A ticket has been opened about this on jQuery bugtracker (ticket #7711) , but as you can see, it was considered has "not a bug", specifying the work-around you found by yourself as a solution: 已经在jQuery bugtracker(门票#7711)上打开了一张关于此问题的故障单 ,但正如您所看到的,它被认为是“没有错误”,指定您自己找到的解决方案作为解决方案:
As a work-around, initialize the outer/parent resizable first and both are resizable
作为解决方法,首先初始化外部/父级可调整大小,并且两者都可以调整大小
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.