diff --git a/dist/css/datepicker.css b/dist/css/datepicker.css index 2ee01d5..7a7f51b 100644 --- a/dist/css/datepicker.css +++ b/dist/css/datepicker.css @@ -53,6 +53,9 @@ border-radius: 2px; } .datepicker--nav-title:hover { background: #eee; } + .datepicker--nav-title.-disabled- { + cursor: default; + background: none; } /* ------------------------------------------------- Datepicker cells diff --git a/dist/js/datepicker.js b/dist/js/datepicker.js index fc2050e..9ab386b 100644 --- a/dist/js/datepicker.js +++ b/dist/js/datepicker.js @@ -413,6 +413,9 @@ var Datepicker; html = Datepicker.template(template, $.extend({title: title}, this.opts)); this.d.$nav.html(html); + if (this.d.view == 'years') { + $('.datepicker--nav-title', this.d.$nav).addClass('-disabled-'); + } this.setNavStatus(); }, @@ -436,7 +439,9 @@ var Datepicker; this.d[action](); }, - _onClickNavTitle: function () { + _onClickNavTitle: function (e) { + if ($(e.target).hasClass('-disabled-')) return; + if (this.d.view == 'days') { return this.d.view = 'months' } @@ -585,7 +590,7 @@ Datepicker.Cell = function () { var _class = "datepicker--cell datepicker--cell-day", currentDate = new Date(), d = Datepicker.getParsedDate(date), - render, + render = {}, html = d.date; if (this.opts.onRenderCell) { diff --git a/js/datepicker/body.js b/js/datepicker/body.js index 0d2e94e..bc003c4 100644 --- a/js/datepicker/body.js +++ b/js/datepicker/body.js @@ -88,7 +88,7 @@ var _class = "datepicker--cell datepicker--cell-day", currentDate = new Date(), d = Datepicker.getParsedDate(date), - render, + render = {}, html = d.date; if (this.opts.onRenderCell) { diff --git a/js/datepicker/navigation.js b/js/datepicker/navigation.js index 2a59df4..c8a79ed 100644 --- a/js/datepicker/navigation.js +++ b/js/datepicker/navigation.js @@ -32,6 +32,9 @@ html = Datepicker.template(template, $.extend({title: title}, this.opts)); this.d.$nav.html(html); + if (this.d.view == 'years') { + $('.datepicker--nav-title', this.d.$nav).addClass('-disabled-'); + } this.setNavStatus(); }, @@ -55,7 +58,9 @@ this.d[action](); }, - _onClickNavTitle: function () { + _onClickNavTitle: function (e) { + if ($(e.target).hasClass('-disabled-')) return; + if (this.d.view == 'days') { return this.d.view = 'months' } diff --git a/sass/datepicker/_navigation.scss b/sass/datepicker/_navigation.scss index c324b75..f10062c 100644 --- a/sass/datepicker/_navigation.scss +++ b/sass/datepicker/_navigation.scss @@ -39,4 +39,9 @@ &:hover { background: $colorCellHover; } + + &.-disabled- { + cursor: default; + background: none; + } } \ No newline at end of file