I have a tootip div in my component. I need to change the position of the tooltip according to the hovered element. How can I do it without using jquery?
1 Answer
Use the native javascript for that. The following methods are useful while positioning an element:
// First get the element
var e = document.getElementById("you-element-id");
- e.position
- e.style.top / e.style.bottom
- e.style.left / e.style.right
- e.style.clientX / e.style.clientY
And try to search for some DOM positioning tutorials on the web.