<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中window、panel、dialog在移动时,超出边框修复
最新推荐文章于 2023-03-01 09:51:22 发布