fires when the mouse is moved over the gantt container
id | string|number | the id of the task that the mouse is moved over |
e | Event | a native event object |
gantt.attachEvent("onMouseMove", function (id, e){
//any custom logic here
});
This event is an alias of the native mousemove event handler attached to the gantt.$root element.
When the event target is a node of a task element, the related task id will be passed into the first argument. Otherwise, the first argument will be null.
gantt.message({
expire: -1,
text: "<span id='pointer-date'></span>"
});
const formatDate = gantt.date.date_to_str("%Y-%m-%d %H:%i");
gantt.attachEvent("onMouseMove", function (id, e){
const helper = gantt.utils.dom;
if(helper.isChildOf(e.target, gantt.$task_data)){
const textContainer = document.querySelector("#pointer-date");
const pos = helper.getRelativeEventPosition(e, gantt.$task_data);
const pointerDate = gantt.dateFromPos(pos.x);
textContainer.innerText = formatDate(pointerDate);
}
});
Related sample: Getting date-time under the mouse cursor