How to automatically scroll the day view to 6am

Hi,

I’m using dhtml scheduler touch and am defaulting to the day view when it first loads. I’d like to automatically scroll the view to 6am as it is very unlikely that any events will be before this time and on a small phone the user is always having to scroll. how do i do this? I tried a hack using jquery to set the webkit-transform of the div with the dhx_scroll_cont class as that’s what changes when you scroll it manually however while it works, it’s causing other issues as the rest of the calendar doesn’t load properly.

the code i had was:

        $$("scheduler").load(url, function() {
           $('.dhx_scroll_cont').css({'-webkit-transform':'translate3d(0px, -170px, 0px)'});
        });

where url is the url of my events json file. -170px was around the 6am mark. what is the correct way to do this?

Many thanks,

Paul

Hi Paul,

try the following:

$$(“scheduler”).$$(“dayList”).attachEvent(“onAfterRender”,function(){
var hour = 6;
this.scrollTo(0,(this.config.timeScaleHeight+1)*hour); // 1 is required to consider border
});

Perfect - thanks Alexandra