[英]JQueryUI draggable and resizable box issue
I use JQueryUI , and this is fiddle example . 我使用JQueryUI,这是小提琴的例子 。
My problem is , as you can see in my fiddle , the text line in resizable
div are overlap each other and my div can drag just one Time . 我的问题是,正如你可以在我的小提琴中看到的那样,
resizable
div中的文本行相互重叠,我的div只能拖动一次 。
How can I fix this issue ? 我该如何解决这个问题?
Javascript 使用Javascript
var DEF_HEIGHT = 100; // the #resizable default height
$( "#resizable" ).resizable({
containment: 'parent',handles: "se",stop:resizeStop,
aspectRatio: true,
resize: function( event, ui ) {
var curHeight = (ui.size.height/ DEF_HEIGHT) * 100;
$(this).css('font-size', curHeight + '%');
}
}).draggable({containment: 'parent', stop:dragStop});
function dragStop(event, ui){
convert_to_percentage($(this));
}
function resizeStop(event, ui){
convert_to_percentage($(this));
}
CSS CSS
#container {
background:black;
position:relative;
margin:0;
line-height:0;
text-align:center;
}
#resizable {
width: 200px;
height: 100px;
padding: 10px;
font-size: 100%;
position:absolute !important;
}
1) your line-height is 0 this is the reason the lines overlap. 1)你的行高为0这就是行重叠的原因。
2) you use a function "convert_to_percentage" which is not present in your code, this is the reason you can only drag it once 2)您使用的函数“convert_to_percentage”在您的代码中不存在,这就是您只能拖动一次的原因
function dragStop(event, ui){
convert_to_percentage($(this));
}
function resizeStop(event, ui){
convert_to_percentage($(this));
}
Have a look at this: http://jsfiddle.net/YxcS8/ 看看这个: http : //jsfiddle.net/YxcS8/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.