First make sure you are looking at the jQuery UI .position
.
https://api.jqueryui.com/position/
I have been assigned to remove the whole jQuery library from the site. I have removed it all, except for 2 functions.
This is the original code section which includes .position
before I started changing things:
if (thingType == "story") {
$(voterEl).closest("li").after(dropDownDiv);
dropDownDiv.position({
my: "left top",
at: "left bottom",
offset: "-2 -2",
of: $(voterEl),
collision: "none",
});
dropDownDiv.css("left", $(voterEl).position().left);
} else {
// place flag menu outside of the comment to avoid inheriting opacity
var voterPos = $(voterEl).position();
dropDownDiv.appendTo($(voterEl).parent());
dropDownDiv.css({
left: voterPos.left,
top: voterPos.top + $(voterEl).outerHeight()
});
}
Does anyone know a simple way to create a div with a relative position to another element via JavaScript? I can change CSS, but I am restricted in that I can't change any HTML, unless I can add it through the javascript.