calendar started

remotes/origin/1203
pavel 11 years ago
parent 02a1ab17cd
commit c1062a293e
  1. 28
      templates/client/static_client/js/_modules/page.profile.calendar.js

@ -20,6 +20,7 @@ if (EXPO.profile.calendar){
//инициализация общих свойств //инициализация общих свойств
that.init = function (options) { that.init = function (options) {
$.extend(this.opt, options); $.extend(this.opt, options);
/** /**
* scrolling calendar object * scrolling calendar object
* depend on mCustomScroll Jquery plugin * depend on mCustomScroll Jquery plugin
@ -34,7 +35,30 @@ if (EXPO.profile.calendar){
$noEventsField = $('.' + this.opt.noEventsClass), $noEventsField = $('.' + this.opt.noEventsClass),
$calendarToggle = $('.' + this.opt.calendarToggleClass), $calendarToggle = $('.' + this.opt.calendarToggleClass),
scrollStep = this.opt.cellWidth * this.opt.cellsToScroll, scrollStep = this.opt.cellWidth * this.opt.cellsToScroll,
index = 0; index = 0,
currentWeekOffset = function () {
var offset = 0,
result = 0,
width = self.opt.cellWidth,
$calendar = $('#' + self.opt.calenadrId),
currentDay = $calendar.find('td.' + self.opt.currentDayClass).index()+1,
onestep = self.opt.cellsToScroll,
allDays = $calendar.find('.'+self.opt.daysClass+' td').length,
stepsCount = allDays / onestep,
currenCount = allDays / currentDay;
result = stepsCount - currenCount;
if (result) {
result = Math.round(result);
offset = onestep * result * width;
} else {
offset = 0;
}
return offset;
};
$(function () { $(function () {
$noEventsField.each(function () { $noEventsField.each(function () {
@ -64,7 +88,7 @@ if (EXPO.profile.calendar){
updateOnBrowserResize: false // Scrollbar will be updated on browser resize updateOnBrowserResize: false // Scrollbar will be updated on browser resize
} }
}); });
$scrollBox.mCustomScrollbar("scrollTo",currentDayOffset); $scrollBox.mCustomScrollbar("scrollTo", currentWeekOffset());
}); });
$leftScroll.on('click', function () { $leftScroll.on('click', function () {
$scrollBox.mCustomScrollbar("scrollTo", '+=' + scrollStep); $scrollBox.mCustomScrollbar("scrollTo", '+=' + scrollStep);

Loading…
Cancel
Save