0.0.11 • Published 1 year ago

mb-timeslider v0.0.11

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Timeslider

JavaScript time slider for desktop and mobile

Specification

Init options

  • container: Required. The HTML element the time slider will be created into. Must already be added to the DOM, so slider knows dimensions.
  • language: the language, e.g. 'en' or 'de'
  • initialDate: Required. Unix timestamp in ms. Determins which date is preselected.
  • now: Optional, defaults to "Date.now()". Unix timestamp in ms. Used for the "now" indicator.
  • first: Required. Unix timestamp in ms. First selectable date.
  • last: Required. Unix timestamp in ms. Last selectable date.
  • interval: The interval between the time steps, e.g. 3 hours
  • playSpeed: Optional, defaults to 1000ms. Playback speed in ms.
  • timeZoneAbbreviationLabel: Displayed as info to the user. Optional.
  • timeZoneOffset: Optional, defaults to 0. Offset from UTC in ms.
  • onChange: Required. Callback function for date change. Takes these parameters:     date: The selected date as Unix timestamp in ms.     timeZone: The UTC offset in ms.
  • arrowKeysEnabled: Select the next/previous time step with the keyboard arrow keys. Default: false.
  • mode: auto (default), desktop or mobile

Methods

  • getDate(): number - returns the date as Unix timestamp in ms
  • setDate(date: number | Date): void - set a date
  • setLoading(isLoading: boolean) - show loading animation
  • destroy() - remove all event listeners and remove from DOM

Features

  • inspired by windy.com time slider
  • optimized slider for desktop and mobile
  • highly responsive
0.0.11

1 year ago

0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.3

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.6

1 year ago

0.0.2

1 year ago