this code can help you to set the position(where xCoordinate & yCoordinate you can find from the above answer ) like this:
document.getElementById("yourDropDownID").style.top = yCoordinate + "px";
document.getElementById("yourDropDownID").style.left = xCoordinate + "px";
Also you want to create those dropdowns,
this [
^] can help you, Best of Luck :)