JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="http://www.jeasyui.com/easyui/themes/default/easyui.css">
<script src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script>
<div id="cc" class="easyui-layout" style="width:600px;height:400px;">
<div data-options="region:'north',title:'North Title',split:true" style="height:100px;"></div>
<div data-options="region:'south',title:'South Title',split:true" style="height:100px;"></div>
<div data-options="region:'east',title:'East',split:true" style="width:100px;"></div>
<div data-options="region:'west',title:'West',split:true" style="width:100px;"></div>
<div data-options="region:'center',title:'center title'" style="padding:0px;background:#eee;position:relative">
<div id="win"></div></div>
</div>
JavaScript
$.extend($.fn.window.methods, {
constrain: function(jq){
return jq.each(function(){
var target = this;
var state = $(target).data('window');
$(target).window('window').draggable({
onDrag: function(e){
var d = e.data;
if (d.left < 0){d.left = 0;}
if (d.top < 0){d.top = 0;}
var parent = state.options.inline ? $(d.parent) : $(window);
if (d.left + $(d.target).outerWidth() > parent.width()){
d.left = parent.width() - $(d.target).outerWidth();
}
if (d.top + $(d.target).outerHeight() > parent.height()){
d.top = parent.height() - $(d.target).outerHeight();
}
state.proxy.css({
display:'block',
left: e.data.left,
top: e.data.top
});
return false;
}
})
})
}
})
$('#win').window({
width:200,
height:150,
modal:true,
inline:true
});
$('#win').window('constrain');