Module: time-based

Time related classes and custom time breakpoints from document loaded event.

Since:
  • 3.0.0

Source:

CSS classes


day-time-$$h
day time class where $$ is actual hour (non zero-padded)
day-period-$periodName$
day pariod class where name can be one of morning, afternoon, evening or night
year-period-$periodName$
year pariod class where name can be one of spring, summer, autumn or winter
$timeBreakpointName$
where name is custom name provided via setTimeBreakPoints
daylight-true
value of calculated daylight after location is provided by setLocation( lat, lng )
daylight-false
value of calculated daylight after location is provided by setLocation( lat, lng )

Methods


JS.Responsive.dayOfYear( [date])

Parameters:
NameTypeArgumentDescription
dateDate<optional>

input Date instance, dafault is new Date()

Since:
  • 3.3.0

Source:
Returns:

day of the year

Type:
Number

JS.Responsive.getDayTimePeriod()

Returns actual day time period. One of morning, afternoon, evening or night.

Since:
  • 3.0.0

Source:
Returns:

Name of actual day time period.

Type:
String

JS.Responsive.getSunrise( [date])

Parameters:
NameTypeArgumentDescription
dateDate<optional>

input Date instance, dafault is new Date()

Since:
  • 3.3.0

Source:
Returns:

date object of sunrise calculated from provided date

Type:
Date

JS.Responsive.getSunrise( [date])

Parameters:
NameTypeArgumentDescription
dateDate<optional>

input Date instance, dafault is new Date()

Since:
  • 3.3.0

Source:
Returns:

date object of sunrise calculated from provided date

Type:
Date

JS.Responsive.getYearPeriod()

Returns actual year period. One of Spring, Summer, Autumn or Winter.

Since:
  • 3.0.0

Source:
Returns:

Name of actual day time period.

Type:
String

JS.Responsive.isDaylight()

Returns actual daylight state

Since:
  • 3.3.0

Source:
Returns:

true for daylight time span

Type:
Boolean

JS.Responsive.setLocation(lat, lng)

Set location to activate daylight detection classes

Parameters:
NameTypeDescription
latNumber

input latitude

lngNumber

input longitude

Since:
  • 3.3.0

Source:
Returns:

true for daylight time span

Type:
Boolean
Example
JS.Responsive.setLocation( 48.136609, 17.107228 ); // Bratislava

JS.Responsive.setTimeBreakPoints(breakpoints)

Sets time brakepoints with classnames and start time value.

Parameters:
NameTypeArgumentDescription
breakpointsArray.<Object>

The employees who are responsible for the project.

breakpoints[].namestring

The name of a breakpoint, this name will be used as className!

breakpoints[].timeNumber

The time after document load in [ms], breakpoint name will be applied.

breakpoints[].remainsNumber|Boolean<optional>

The time in [ms], breakpoint name will be removed (optional). Or TRUE value to prevent replacing with next breakpoint.

Since:
  • 3.0.0

Source:
Example
JS.Responsive.setTimeBreakPoints( config )

Events


changedDayTime
{String} dayTimeCurrent, {String} lastDayTime, both have same syntax as classes (day-time-$$h)
changedDayPeriod
{String} dayTimePeriod, {String} lastDayTimePeriod, both have same syntax as classes (day-period-$periodName$)
changedYearPeriod
{String} yearPeriod, {String} lastYearPeriod, both have same syntax as classes (year-period-$periodName$)
timeBreakpointReached
{String} timeBreakPointReached - name provided via setTimeBreakPoints, {String|Undefined} timeBreakPointPrevious - if any