[ 3 posts ]

Jay

  • Username: javcly
  • Joined: Thu Aug 16, 2012 12:56 am
  • Posts: 21
  • IRC: yui
  • Offline
  • Profile
Tags:

YUI 3 Resize widget behaves strangely when constrain applied

Post Posted: Thu Aug 16, 2012 1:17 am
+0-
Hi all,

suppose I have the following html content :

Code:
<div id="parent" style="position:relative;border:1px solid">
      <div id="child" style = "position:absolute;width:800px;height:600px;">
</div>


now i create a resize widget :

new Y.Resize({
node : '#child'
}).plug(Y.Plugin.ResizeConstrained, {
constrain : '#parent'
});
then i create a drag for the child element so that it is draggable within the parent :

new Y.DD.Drag({
node :'#child'
}).plug(Y.Plugin.DDConstrained, {
constrain2node : '#parent'
});

I open the page in the browser (either firefox, chrome,ie) , drag the child to the top left corner of the parent, then drag the bottom handle of resize downwards, the resize with also shrink the width of the element from right to left as i drag the bottom handle down. If I remove the border of the parent, it works fine.

I think it is because with child having absolute position and parent having a border, when in the top left corner of the parent, the left/top positon of child will be negative, but the child is supposed to be constrained in the parent(set by the Resize).

Is it a bug or am I using the widgets incorrectly?
Thanks.

Dav Glass

  • Username: davglass
  • Joined: Thu Aug 28, 2008 9:28 am
  • Posts: 2088
  • Location: Marion, IL, US
  • Twitter: davglass
  • GitHub: davglass
  • Gists: davglass
  • IRC: davglass
  • Offline
  • Profile

Re: YUI 3 Resize widget behaves strangely when constrain app

Post Posted: Thu Aug 16, 2012 8:13 am
+0-
If you want to constrain something properly, you need to make sure that the "parent" element doesn't have any styles that will interfere with the constrain or things will be bad. Add a div between "parent" and "child" and use that as your constrain parent.

Jay

  • Username: javcly
  • Joined: Thu Aug 16, 2012 12:56 am
  • Posts: 21
  • IRC: yui
  • Offline
  • Profile

Re: YUI 3 Resize widget behaves strangely when constrain app

Post Posted: Mon Aug 20, 2012 6:42 pm
+0-
Hi Dav, thanks for the reply. yeah problem solved after adding a div between parent and children. cheeers
  [ 3 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
cron