DHTMLX Timeline

I am using DHTMLX timeline view.I am changing the views based on Scroll…and I want to go to the same date in which mouse is while scrolling.Can you help me out how to do that?

Hello @Test_test,

As I understand, you are using the scrollable timeline, am I right?

If so, you can get the date under scroll position with the dateFromPos method. So you will be use it for the setCurrentView method from the onScroll event. The only thing that you have to control is to create some condition, to not fire it on each onScroll call, because this event fires pretty frequently.

So the code may look like follows:


timeline.attachEvent("onScroll", function(left, top){
if(someCondition){
    const date = timeline.dateFromPos(left);
    scheduler.setCurrentView();
    scheduler.setCurrentView(date, "requiredView");
}
});

Kind regards,