您的位置:首页 > 产品设计 > UI/UE

easyui中window、panel、dialog在移动时,超出边框修复

2016-10-20 12:05 483 查看
<script type="text/javascript">
var panelMo = function(left, top) {
var parentObj = $(this).panel('panel').parent();
if (left < 0) {
$(this).window('move', {
left : 1
});
}
if (top < 0) {
$(this).window('move', {
top : 1
});
}
var width = $(this).panel('options').width;
var height = $(this).panel('options').height;
var right = left + width;
var buttom = top + height;
var parentWidth = parentObj.width();
var parentHeight = parentObj.height();
if(parentObj.css("overflow")=="hidden"){
if(left > parentWidth-width){
$(this).window('move', {
"left":parentWidth-width

});
}
if(top > parentHeight-height){
$(this).window('move', {
"top":parentHeight-height
});
}
}
}
$.fn.panel.defaults.onMove = panelMoving;
$.fn.window.defaults.onMove = panelMoving;
$.fn.dialog.defaults.onMove = panelMoving;
</script>
这样写会出现一个问题,就是在窗口在拉伸时,如果碰到边界,那么页面上的标签都会失效,所以要在窗口加一个属性,禁止拉伸 resizable="false"
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  easyui move