I want to make a loading tip when you click on a button. Below is my attempt,
this.mouse_loader_click = function(){
/* CONFIG */
xOffset = 10;
yOffset = 20;
$(".mouse-loader").click(function(e){
/* append the popup */
$(document.body).append("<p class='loading-tip'>Loading</p>");
$(".loading-tip")
.css("top",(e.pageY - xOffset) + "px")
.css("left",(e.pageX + yOffset) + "px")
.fadeIn("fast");
$(document.body).mousemove(function(e){
$(".loading-tip")
.css("top",(e.pageY - xOffset) + "px")
.css("left",(e.pageX + yOffset) + "px");
});
return false;
});
};
But it works funny because the loading element
- ".loading-tip" does not move along with the mouse smoothly. It seems jerky all the time.
But it works fine and moves smoothly with the mouse if it is inside a box.
Have a look here please.
What have I missed? How can I fix it?