[ 3 posts ]

Steven McHugh

  • Username: semchugh
  • Joined: Thu Apr 05, 2012 12:32 pm
  • Posts: 2
  • Offline
  • Profile

How to select resized node? - YUI 3 Resize Utility

Post Posted: Thu Apr 05, 2012 12:49 pm
+0-
I'm using the YUI 3 Resize Utility to resize a number of div's in a parent div. When resizable div is selected for resizing, I would like to perform some logic on it. I can use the 'click' event to select the node if it is clicked on before resizing, but if a user clicks on the resize handles to start the resizing, the 'click' event does not notice that the div, or any of its children, have been clicked on. I can get around this by using the 'resize:start' event for my Resize object, but then I'm left with the event target being the resize object, and I can not find a way to get the node it was being used on. Anyone have any ideas? Thanks. Find the code at http://pastie.org/3735193

Steven McHugh

  • Username: semchugh
  • Joined: Thu Apr 05, 2012 12:32 pm
  • Posts: 2
  • Offline
  • Profile

Re: How to select resized node? - YUI 3 Resize Utility

Post Posted: Fri Apr 06, 2012 11:19 am
+0-
Figured it out. For those interested in the solution: For any of the resize:* events attached to a Resize object, you can get the node being resized in your event function with "this.get('node')". Even though in the attributes tree it shows that node value to be null, somehow it's actually there.

Juan Ignacio Dopazo

YUI Contributor

  • Username: jdopazo
  • Joined: Fri Oct 02, 2009 5:39 am
  • Posts: 620
  • Location: Buenos Aires, Argentina
  • Twitter: juandopazo
  • GitHub: juandopazo
  • Gists: juandopazo
  • Offline
  • Profile

Re: How to select resized node? - YUI 3 Resize Utility

Post Posted: Mon Apr 09, 2012 6:51 am
+0-
I think there are many ways of doing it. resize:start is one way. You can get the node from the resize instance by doing e.target.get('node').

Another way would be to use event delegation on the mousedown event.
  [ 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