Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/koss-lebedev/bootstrap-duration-picker
Bootstrap Duration picker
https://github.com/koss-lebedev/bootstrap-duration-picker
bootstrap bootstrap-duration-picker duration plugin
Last synced: 20 days ago
JSON representation
Bootstrap Duration picker
- Host: GitHub
- URL: https://github.com/koss-lebedev/bootstrap-duration-picker
- Owner: koss-lebedev
- License: mit
- Created: 2015-11-30T08:07:38.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2020-11-25T14:03:24.000Z (almost 4 years ago)
- Last Synced: 2024-10-13T21:43:47.140Z (about 1 month ago)
- Topics: bootstrap, bootstrap-duration-picker, duration, plugin
- Language: JavaScript
- Homepage: https://github.com/koss-lebedev/bootstrap-duration-picker
- Size: 83 KB
- Stars: 29
- Watchers: 4
- Forks: 28
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bootstrap-duration-picker
Javascript library for selecting duration. Target input to which plugin is applied will contain duration in seconds.
[![Code Climate](https://codeclimate.com/github/koss-lebedev/bootstrap-duration-picker/badges/gpa.svg)](https://codeclimate.com/github/koss-lebedev/bootstrap-duration-picker)
[![npm version](https://badge.fury.io/js/bootstrap-duration-picker.svg)](https://badge.fury.io/js/bootstrap-duration-picker)
[![Bower version](https://badge.fury.io/bo/bootstrap-duration-picker.svg)](https://badge.fury.io/bo/bootstrap-duration-picker)## Installation
Using Bower:
bower install bootstrap-duration-picker
Using NPM:
npm install bootstrap-duration-picker
Or simply copy `bootstrap-duration-picker.css` and `bootstrap-duration-picker.js` files to your project.
## Example
![Bootstrap-Duration-Picker](demo.png)
## Dependencies
- jQuery 1.*
- Bootstrap 3.* (for styling only)## Usage
```js
$('.duration-picker').durationPicker();// or
$('.duration-picker').durationPicker({
// optional object with translations (English is used by default)
translations: {
day: 'dia',
hour: 'hora',
minute: 'minuto',
second: 'segundo',
days: 'dias',
hours: 'horas',
minutes: 'minutos',
seconds: 'segundos',
},// defines whether to show seconds or not
showSeconds: false,// defines whether to show days or not
showDays: true,// callback function that triggers every time duration is changed
// value - duration in seconds
// isInitializing - bool value
onChanged: function (value, isInitializing) {
// isInitializing will be `true` when the plugin is initialized for the
// first time or when it's re-initialized by calling `setValue` method
console.log(value, isInitializing);
}
});
```## Public methods
Method
Example
Description
setValue
$('#selector').data('durationPicker').setValue(0);
Allows to reinitialize duration picker value after it's been created. Accepts new number of seconds
destroy
$('#selector').data('durationPicker').destroy();
Destroys the plugin, reverting any DOM changes made by the plugin
## License
Please see [LICENSE](LICENSE) for licensing details.