parent
2db0813f74
commit
f5cdb64893
5 changed files with 1604 additions and 112 deletions
File diff suppressed because one or more lines are too long
@ -0,0 +1,88 @@ |
|||||||
|
var EXPO = EXPO || {}; //isolated namespace
|
||||||
|
EXPO.profile = EXPO.profile || {}; |
||||||
|
if (EXPO.profile.calendar){ |
||||||
|
console.warn('WARNING: EXPO.profile.calendar is already defined!'); |
||||||
|
}else { |
||||||
|
|
||||||
|
EXPO.profile.calendar = (function () { |
||||||
|
// dependencies
|
||||||
|
var com = EXPO.common; |
||||||
|
|
||||||
|
// variables
|
||||||
|
var that = {}; |
||||||
|
|
||||||
|
that.opt = {}; //свойства по умолчанию
|
||||||
|
//private
|
||||||
|
$(function () { |
||||||
|
}); |
||||||
|
|
||||||
|
// methods
|
||||||
|
//инициализация общих свойств
|
||||||
|
that.init = function (options) { |
||||||
|
$.extend(this.opt, options); |
||||||
|
/** |
||||||
|
* scrolling calendar object |
||||||
|
* depend on mCustomScroll Jquery plugin |
||||||
|
* @type {*|jQuery|HTMLElement} |
||||||
|
*/ |
||||||
|
var $scrollBox = $('#'+this.opt.scrollBoxId), |
||||||
|
$calendar = $('#'+this.opt.calenadrId), |
||||||
|
currentDayOffset = $calendar.find('td.'+this.opt.currentDayClass).index()*this.opt.cellWidth, |
||||||
|
$leftScroll = $('#'+this.opt.scrollLeftId), |
||||||
|
$rightScroll = $('#'+this.opt.scrollRightId), |
||||||
|
$calendarToggle = $('.'+this.opt.calendarToggleClass); |
||||||
|
scrollStep = this.opt.cellWidth*this.opt.cellsToScroll; |
||||||
|
|
||||||
|
$(window).load(function(){ |
||||||
|
$scrollBox.mCustomScrollbar({ |
||||||
|
axis:'y', |
||||||
|
horizontalScroll: true, |
||||||
|
advanced:{ // Advanced options
|
||||||
|
autoScrollOnFocus: false, |
||||||
|
updateOnContentResize: false, // Scrollbar will be updated on content resize
|
||||||
|
updateOnBrowserResize: false // Scrollbar will be updated on browser resize
|
||||||
|
} |
||||||
|
}); |
||||||
|
$scrollBox.mCustomScrollbar("scrollTo",currentDayOffset); |
||||||
|
}); |
||||||
|
$leftScroll.on('click', function () { |
||||||
|
$scrollBox.mCustomScrollbar("scrollTo",'+='+scrollStep); |
||||||
|
}); |
||||||
|
$rightScroll.on('click', function () { |
||||||
|
$scrollBox.mCustomScrollbar("scrollTo",'-='+scrollStep); |
||||||
|
}); |
||||||
|
$calendarToggle.on('click', function () { |
||||||
|
var $switch = $(this); |
||||||
|
var $sect = $switch.closest('.ep-sect'); |
||||||
|
var $sectBody = $sect.children('div.ep-sect-body'); |
||||||
|
|
||||||
|
if ($sect.hasClass('eps-opened')) { |
||||||
|
$rightScroll.hide(); |
||||||
|
$leftScroll.hide(); |
||||||
|
$sectBody |
||||||
|
.stop() |
||||||
|
.animate({ |
||||||
|
height: 0, |
||||||
|
opacity: 0 |
||||||
|
}, 300, function () { |
||||||
|
$sect.removeClass('eps-opened'); |
||||||
|
}); |
||||||
|
} else { |
||||||
|
$rightScroll.show(); |
||||||
|
$leftScroll.show(); |
||||||
|
$sectBody |
||||||
|
.stop() |
||||||
|
.animate({ |
||||||
|
height: 'auto', |
||||||
|
opacity: 1 |
||||||
|
}, 300, function () { |
||||||
|
$sect.addClass('eps-opened'); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
return false; |
||||||
|
}); |
||||||
|
}; |
||||||
|
return that; |
||||||
|
}()); |
||||||
|
} |
||||||
Loading…
Reference in new issue