EasyUI Forum
June 16, 2024, 11:22:01 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: How to limit draggable/window movement?  (Read 13263 times)
gultor
Newbie
*
Posts: 3


View Profile
« on: August 22, 2012, 08:38:42 AM »

Hi All,

Is there any way to limit draggable/window movement only within it's parent?
Specifically, constraint movement just like jqueryui does using containment: "parent" option.

Thanks for your help.
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: August 22, 2012, 07:52:36 PM »

Set 'inline' property to true to stay inside its parent.
Logged
gultor
Newbie
*
Posts: 3


View Profile
« Reply #2 on: August 22, 2012, 11:19:20 PM »

Thanks stworthy for your response.

I tried, but it only hide part of the window if it cross its parent. If the window title is accidentally hidden, then we will lost control and cannot move the window again.
What I want is it never cross the parent, so all the window is visible inside the parent. Is that possible?

Thank you.
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #3 on: August 23, 2012, 12:28:53 AM »

The 'onMove' event fires while the window is being moved. A solution to control the window position is to write some code in 'onMove' event.
Code:
$.extend($.fn.window.defaults, {
onMove: function(left,top){
if (left<0){
$(this).window('move',{
left:0
});;
}
if (top < 0){
$(this).window('move',{
top:0
});;
}
}
});
Logged
gultor
Newbie
*
Posts: 3


View Profile
« Reply #4 on: August 23, 2012, 08:33:20 AM »

Thank you very much. It works like a charm  Smiley
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!