Hi to all experts over here My question is all about jquery. I am using draggable dropabble methods.I have a droppable div(parent) . And on drag and drop of a element (which is a div itself) to left of droppable div (parent div) , elements gets appended to left ...if dropped close to right it appends to right.
For this I am using left right positioning (for eg:left:30px , right:40px). I hv used float right left too.
Upto here its working perfectly.
Now I want to implement sorting too...I mean the elements within the droppable container (parent div) should sort too. For which I have used ui.sortable . But its not working since the DOM elements have a fixed position so it does not sort.
Now I am tried changing the css of DOM elements on first attempt to sort
$( ".parent" ).sortable({
placeholder: "highlight",
stop:function(event,ui){
$(".parent").children("div").css("float","left");
$(".parent").children("div").css("position","relative");
$(".parent").children("div").css("right","");
$(".parent").children("div").css("left","");
} });
The Above code does not sort in the first attempt but rearranges the DOM elements according to the DOM position as in code .After the First attempt it changes the css and it sorts perfectly. I want sorting on first attempt itself without rearranging of child divs
Notice: sortable is not working since i have given the dom positions..or float values....
I wish I could show a full demo but i cant. However i have made a small demo of it. First watch this This Here You cant sort item 3 with others. Now watch this . Click here it works but on first attempt it just rearranges and after that it works perfectly.Simillar to my question. Please read my above question and see both demos
Please tell me if anyone knows a solution.