I have flexible notepad (or Calendar) like tool on my page. I don't want to use Full Calendar and I can't seem to accomplish one particular functionality to complete my custom project.
I'm probably going to get down voted on this one because I may be to general on my approach (the best starting point), but I'll do my best to ask a real question of value here.
The Question:
Can absolute positioned elements "detect" each other and move down (like JQ UI sortable) when a new element is dropped in the same parent?
I have two or more adjacent cells (parents) (like a Calendar), the "notes" (child elements) have to be absolute position to exceed the width of their parent.
Here is the Generic "staring point":
*My Grid (parents) can be Div or Table. I've managed to get the child elements to extend/overlap beyond the parent to cover multiple adjacent cells. They drop perfect on the droppable area and align top left, but the dropped items don't see each other.
To FullCalander's credit, it does this perfect in the month view:(below)
- So my issue may be that absolute position is not the way to go
- Sortable may be the answer, but the child wont exceed the parent width
- I've tried CSS and read many absolute position articles here at Stack
I have a feeling, my approach is wrong (using absolute) so hopefully the down voters will have mercy on my soul and explain that the answer to my question is "no, they can not" but make a suggestion to improve my approach at this challenge.
$(".droppable").droppable({
drop: function (event, ui) {
accept: ".draggable"
activeClass: "ui-state-hover"
hoverClass: "ui-state-active"
$(ui.draggable).offset($(this).offset());
// $(ui.draggable).data('dropped', true);
//var count = $(this).length;
var currentPos = $(this).position();
$("#pos").text("CURRENT: \nLeft: " + currentPos.left + "\nTop: " + currentPos.top);
var count = $(this).length; //wrong child count or absolute not found/counted
var count = $(this).children.length; //wrong child count or absolute not found/counted
// alert(count);
//this shoud show child count like .length - broken
// var countChild = (document.elementFromPoint(currentPos.top, currentPos.left));
// alert(countChild);
// console.log(countChild);
}
});