核心方法:
function initMoveTooltip1(id, tp) { var $element = typeof id === "string" ? $("#" + id) : $(id); var $tp = $("#" + tp); var x = 10; var y = 20; var title = $element.find(".fc-event-title").text(); $element.mouseover(function (e) { $("#eventMoveTooltipTitle").text(title); $tp.show("fast"); $tp.css({ "top": (e.pageY + y) + "px", "left": (e.pageX + x) + "px" }).show(); //设置x坐标和y坐标,并且显示 }).mouseout(function () { $tp.hide(); }).mousemove(function (e) { $tp.css({ "top": (e.pageY + y) + "px", "left": (e.pageX + x) + "px" }); }); } function initEditTooltip(id, tp, time) { var $element = $("#" + id); var $tp = $("#" + tp); $element.mouseover(function (e) { $tp.show(); var offset = $(this).offset(); var y = $(this).height(); $tp.css({ "top": (offset.top) + "px", "left": (offset.left) + "px" }).show("fast"); }) }