I have to display element on mouseover
.
There are details in this element which are brough through ajax.
The problem that the UI is not "smooth" due to ajax issue.
The return false is executed before success. Why?
var companyInfoHeight = $("#company-info").outerHeight();
$('.notifications-container .notification .notification-info .notification-from-user').on('mouseover', function(event){
var base = $(this)
jQuery.ajax({
url: tooltipUrl,
type:'POST',
data: {userId : $(this).attr('data-userid')},
success:function(data,textStatus){
$("#personInfo").html(data)
$("#personInfo").css({'top':base.offset().top-userInfoHeight-115,'left':base.offset().left}).show();
}
});
return false;
})
function onMouseOut(){
$('.user-info').on('mouseleave', function(event){
$(this).hide();
})
}
onMouseOut();