$('.class1').on('mouseenter', function () {
var top_offset = $(this).position().top;
var left_offset = $(this).position().left;
$('.icon').prependTo($(this)).css({
position: "absolute",
top: top_offset,
left: left_offset
});
});
I am trying to achieve a hover effect where, on mouse enter, I can retrieve the position of an element and smoothly move an icon to that exact position with animation. How can this be accomplished effectively?