A little problem with style..
Hello I've a little problem with style.. I add dynamically style to item, but after drag or resize, it lose the style. I've tried to add again style after drop event, but it continue to doesn't work... were I did a mistake. Thanks for all Daniele
What styles are you adding dynamically? Is there any reason why you wouldn't style it via a css file??
at the moment shadow and background. I try to develop an application where user could change style of items (and move them). Maybe I could override "move_node" function?
Ok I found a little solution.. store some styles in "on_end_moving" function (before removeAttr('style')) and restore them at the end of function
Can you explain or give an example of what you're going to implement.
Yes of course:
var o = $(this); node.el = o; self.placeholder.hide();
//Store styles
var initialShadow = $(o).css("box-shadow");
var initialMoxShadow = $(o).css("-moz-box-shadow");
var initialWebKitShadow = $(o).css("-webkit-box-shadow");
var initialBackground = $(o).css("background");
var initialTextAlign = $(o).css("text-align");
//ecc...
o
.attr('data-gs-x', node.x)
.attr('data-gs-y', node.y)
.attr('data-gs-width', node.width)
.attr('data-gs-height', node.height)
.removeAttr('style');
self._update_container_height();
self.container.trigger('change', [self.grid.get_dirty_nodes()]);
self.grid.end_update();
//Assign again styles
$(o).css("box-shadow",initialShadow);
$(o).css("-moz-box-shadow",initialMoxShadow);
$(o).css("-webkit-box-shadow",initialWebKitShadow);
$(o).css("background", initialBackground);
$(o).css("text-align", initialTextAlign);
//Ecc.........
You could use the '.ui-draggable-dragging' and '.ui-resizable-resizing' selectors to negate any styles on the placeholders when you drag or resize??
It is better to use CSS to customize how draggable item should look like. Please check this out