diff --git a/templates/client/static_client/js/_modules/page.profile.calendar.js b/templates/client/static_client/js/_modules/page.profile.calendar.js index 7d1668d1..87664b39 100644 --- a/templates/client/static_client/js/_modules/page.profile.calendar.js +++ b/templates/client/static_client/js/_modules/page.profile.calendar.js @@ -46,19 +46,31 @@ if (EXPO.profile.calendar) { result = 0, width = self.opt.cellWidth, $calendar = $('#' + self.opt.calenadrId), - currentDay = $calendar.find('td.' + self.opt.currentDayClass).index()+1, + currentDay = $calendar.find('td.' + self.opt.currentDayClass).index(), onestep = self.opt.cellsToScroll, allDays = $calendar.find('.'+self.opt.daysClass+' td').length, - stepsCount = allDays / onestep, - currenCount = allDays / currentDay; - result = stepsCount - currenCount; + stepsCount, + currenCount; self.stepWidth = onestep*width; self.calendarWidth = width* allDays; - if (result) { - result = Math.floor(result); - offset = onestep * result * width; - } else { + if(currentDay > 0){ + currentDay++; + stepsCount = allDays / onestep; + currenCount = allDays / currentDay; + + result = stepsCount - currenCount; + + self.currentDay =currentDay; + if (result) { + result = Math.floor(result-1); + offset = onestep * result * width; + } else { + + offset = 0; + } + }else{ + self.currentDay = 0; offset = 0; }