uiLayer.draggable({
elem: '#' + id,
group: "resizeDiv",
axis:axis,
hint: function(e) {
var divOnResize = $("<div id='divOnResize' ></div>");
divOnResize.appendTo(that.$el);
divOnResize.addClass("resize-div");
divOnResize.css("width", cssProperty.width);
divOnResize.css("height", cssProperty.height);
divOnResize.css("left", cssProperty.left);
divOnResize.css("top", cssProperty.top);
return divOnResize;
},
dragstart: function (e) {
console.log("It started");
},
dragend: function (e) {
// var divOnResize = that.$el.find("#divOnResize");
// divOnResize.remove();
}
});
When I drag the element along y axis the css left property of the hint changes and becomes equal to that of the element which is dragged . I dont want to change the left and width while dragging along y-axis and height and top while dragging along x-axis . Can this be done ?? If so ,how??
You can use options combination:
container
andaxis
like below in Kendo UI draggableaxis
: Constrains the hint movement to either the horizontal (x) or vertical (y) axis.container
: With this hint movement can be constrained to the container boundarySee below example snippet: I took
axis
direction as "y" andcontainer
is parent element.