add resize event, modify readme

This commit is contained in:
t1m0n 2015-11-28 20:16:55 +03:00
parent 810bc399be
commit c9659eb5cf
4 changed files with 20 additions and 2 deletions

View File

@ -13,7 +13,7 @@ $('.my-datepicker').datepicker([options])
```
## Demo and docs
[Demo]()
[Demo](http://t1m0n.name/air-datepicker/docs/)

View File

@ -136,6 +136,7 @@ var Datepicker;
this.$el.on('input', this._onInput.bind(this));
this.$datepicker.on('mousedown', this._onMouseDownDatepicker.bind(this));
this.$datepicker.on('mouseup', this._onMouseUpDatepicker.bind(this));
$(window).on('resize', this._onResize.bind(this))
},
isWeekend: function (day) {
@ -480,6 +481,8 @@ var Datepicker;
},
setPosition: function (position) {
position = position || this.opts.position;
var dims = this._getDimensions(this.$el),
selfDims = this._getDimensions(this.$datepicker),
pos = position.split(' '),
@ -578,6 +581,12 @@ var Datepicker;
}
},
_onResize: function () {
if (this.visible) {
this.setPosition();
}
},
get parsedDate() {
return Datepicker.getParsedDate(this.date);
},

File diff suppressed because one or more lines are too long

View File

@ -136,6 +136,7 @@ var Datepicker;
this.$el.on('input', this._onInput.bind(this));
this.$datepicker.on('mousedown', this._onMouseDownDatepicker.bind(this));
this.$datepicker.on('mouseup', this._onMouseUpDatepicker.bind(this));
$(window).on('resize', this._onResize.bind(this))
},
isWeekend: function (day) {
@ -480,6 +481,8 @@ var Datepicker;
},
setPosition: function (position) {
position = position || this.opts.position;
var dims = this._getDimensions(this.$el),
selfDims = this._getDimensions(this.$datepicker),
pos = position.split(' '),
@ -578,6 +581,12 @@ var Datepicker;
}
},
_onResize: function () {
if (this.visible) {
this.setPosition();
}
},
get parsedDate() {
return Datepicker.getParsedDate(this.date);
},