I have this function (below) which im using to show a div (progress) and center it over another div (diary) on my page as some ajax is called.
It all works, except that it always pops an alert showing the "position" jquery function. Anyone else had this problem using position?? function ShowProgress() { var diaryTop = $("#diary").position()["top"]; var diaryLeft = $("#diary").position()["left"]; var diaryWidth = $("#diary").width(); var diaryHeight = $("#diary").height(); var progressWidth = $("#progress").width(); var progressHeight = $("#progress").height(); var x = (Math.round(diaryWidth / 2) - Math.round(progressWidth / 2)) + diaryLeft; var y = (Math.round(diaryHeight / 2) - Math.round(progressHeight / 2)) + diaryTop; $("#progress").css({ "position":"absolute","left": x, "top":y }); $("#progress").toggle(); }