Selector de tiempo de reloj analógico en Vanilla JavaScript
| Autor: | ZulNs |
|---|---|
| Views Total: | 193 |
| Sitio oficial: | Ir a la web |
| Actualizado: | March 6, 2019 |
| Licencia: | MIT |
Vista prévia
Descripción
A vanilla JavaScript library to create an analog clock which can be used as a time picker where the users are able to pick a time by dragging the hour & minute hands.
Funcionamiento
Descargue e importe el archivo JavaScript TimePicker. js en el documento.
<script src="timepicker.js"></script>
Cree un nuevo selector de tiempo de reloj analógico con los siguientes parámetros:
- isClockMode: es el modo de reloj?
- is24HoursSystem: utiliza el reloj de 24 horas?
- hora/minuto/segundo: utiliza la hora local actual si no está definida
Timepicker(isClockMode, is24HoursSystem, hour, minute, second)
API methods.
// toggles clock mode changeClockMode() // toggles between 24-hour and 12-hour clock changeHourSystem() // destroys the clock destroy() // returns the clock element getElement() // returns the selected hours getHours() // returns the selected minutes getMinutes() // returns the selected time string getTimeString() // shows the clock hide() // hides the clock hide() // checks if is 24-hour clock is24HoursSystem() // checks if is clock mode isClockMode() // checks if is hidden isHidden() // sets styles setDisplayStyle(style) // sets time setHours(hours) setMinutes(minutes) setSeconds(seconds)





