Search code examples
cssdomyuidrag

YUI - Set padding style to drag node


I'm trying to set padding style to my drag node. I can set background-color but not padding.

 Y.DD.DDM.on('drag:start', function(e) {

   var drag = e.target;

   drag.get('dragNode').setStyles({
       backgroundColor: drag.get('node').getStyle('backgroundColor'),                   
       padding: drag.get('node').getStyle('padding')
   });
 });

What I'm doing wrong ?


Solution

  • As said here : http://yuilibrary.com/trac-archive/tickets/2528774.html

    I have to request all attributes individually with getComputedStyle()

     paddingTop: drag.get('node').getComputedStyle('paddingTop'),
     paddingBottom: drag.get('node').getComputedStyle('paddingBottom'),
     paddingRight: drag.get('node').getComputedStyle('paddingRight'),
     paddingLeft: drag.get('node').getComputedStyle('paddingLeft')