Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/pr/191' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Twipped committed Sep 23, 2016
2 parents 6b0c05b + af9e935 commit 7acee8e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
4 changes: 4 additions & 0 deletions build/kalendae.standalone.js
Original file line number Diff line number Diff line change
Expand Up @@ -1092,6 +1092,10 @@ Kalendae.Input = function (targetElement, options) {
}
$input.value = self.getSelected();
util.fireEvent($input, 'change');
if (opts.closeOnSelection && opts.mode === 'single') {
$input.blur();
self.hide();
}
});

};
Expand Down
10 changes: 10 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,16 @@ <h1>Kalendae</h1>
months:2
});
</script>
<hr>

Click this input element (Auto closes after selection): <input type="text" value="2/16/2012" id="input2">
<script type="text/javascript" charset="utf-8">
var k4 = new Kalendae.Input('input2', {
months:1,
closeOnSelection: true
});
</script>


<hr>
This calendar is auto-created.
Expand Down
4 changes: 4 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ The following options are available for configuration.
- In "multiple" mode, strings may contain multiple dates separated by commas. *ex: 2/3/2012, 3/15/2012, 4/2/2012*
- In "range" mode, strings may contain two dates separated by a hyphen. *ex: 2/3/2012 - 3/15/2012*

- `closeOnSelection`: Close the calendar popup when a date is selected.
- Only works in `Kalendae.Input` and in `single` mode.
- Default is `false`.

- `months`: The total number of months to display side by side on the calendar.
- Default is `1`.

Expand Down
4 changes: 4 additions & 0 deletions src/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ Kalendae.Input = function (targetElement, options) {
}
$input.value = self.getSelected();
util.fireEvent($input, 'change');
if (opts.closeOnSelection && opts.mode === 'single') {
$input.blur();
self.hide();
}
});

};
Expand Down

0 comments on commit 7acee8e

Please sign in to comment.