Base

Globals.js

Contains variables that makes css variables usable in javascript. Also has layout/theme change events that are available througout the template.

Variables

Using css variables in the javascript unifies all the colors accross the template. For example, you may get primary color value and use it with a javascript plugin such as a chart. If you want to learn more about the css part of the variables, please see Theme Variables . You may reach them with below values.

Example
// Returns primary color
var primary = Globals.primary;

// Returns xl breakpoint
var xl = Globals.xl;

// Returns standard text font
var font = Globals.font;
Contents
NAME
DESCRIPTION
NAME
Globals.primary
DESCRIPTION
Primary color.
NAME
Globals.secondary
DESCRIPTION
Secondary color.
NAME
Globals.tertiary
DESCRIPTION
Tertiary color.
NAME
Globals.quaternary
DESCRIPTION
Quaternary color.
NAME
Globals.body
DESCRIPTION
Main text color.
NAME
Globals.alternate
DESCRIPTION
Alternate text color.
NAME
Globals.lightText
DESCRIPTION
Light text color for colored backgrounds.
NAME
Globals.warning
DESCRIPTION
Warning color.
NAME
Globals.danger
DESCRIPTION
Danger color.
NAME
Globals.success
DESCRIPTION
Success color.
NAME
Globals.info
DESCRIPTION
Info color.
NAME
Globals.font
DESCRIPTION
Main font face.
NAME
Globals.fontHeading
DESCRIPTION
Heading and menu font face.
NAME
Globals.background
DESCRIPTION
Background color.
NAME
Globals.foreground
DESCRIPTION
Foreground color.
NAME
Globals.separator
DESCRIPTION
Separator color.
NAME
Globals.separatorLight
DESCRIPTION
Light separator color.
NAME
Globals.transitionTimeShort
DESCRIPTION
Short transition time without 'ms'.
NAME
Globals.transitionTime
DESCRIPTION
Transition time without 'ms'.
NAME
Globals.navSizeSlim
DESCRIPTION
Height of the horizontal menu.
NAME
Globals.primaryrgb
DESCRIPTION
Comma separated rgb values of primary color.
NAME
Globals.secondaryrgb
DESCRIPTION
Comma separated rgb values of secondary color.
NAME
Globals.tertiaryrgb
DESCRIPTION
Comma separated rgb values of tertiary color.
NAME
Globals.quaternaryrgb
DESCRIPTION
Comma separated rgb values of quaternary color.
NAME
Globals.borderRadiusXl
DESCRIPTION
Xl border radius.
NAME
Globals.borderRadiusLg
DESCRIPTION
Lg border radius.
NAME
Globals.borderRadiusMd
DESCRIPTION
Md border radius.
NAME
Globals.borderRadiusSm
DESCRIPTION
Sm border radius.
NAME
Globals.sm
DESCRIPTION
Sm breakpoint in pixel.
NAME
Globals.md
DESCRIPTION
Md breakpoint in pixel.
NAME
Globals.lg
DESCRIPTION
Lg breakpoint in pixel.
NAME
Globals.xl
DESCRIPTION
Xl breakpoint in pixel.
NAME
Globals.xxl
DESCRIPTION
Xxl breakpoint in pixel.

Events

The events are mostly for the settings changes and listened by the base scripts but some of them might be usefull in other parts of the template. For example, you may want to listen to color change event to save user preference silently in the backend.

Example
// Listens for the color change event
document.documentElement.addEventListener(Globals.colorAttributeChange, function(event) {
  // Returns color such as light-blue
  var color = event.detail;
});
Contents
NAME
VALUE
DESCRIPTION
NAME
Globals.menuPlacementChange
VALUE
MENU_PLACEMENT_CHANGE
DESCRIPTION
Fires when placement value changes. Carries value in detail variable.
NAME
Globals.menuBehaviourChange
TYPE
MENU_BEHAVIOUR_CHANGE
DESCRIPTION
Fires when behaviour value changes. Carries value in detail variable.
NAME
Globals.layoutChange
VALUE
MENU_LAYOUT_CHANGE
DESCRIPTION
Fires when layout value changes to boxed or fluid.
NAME
Globals.colorAttributeChange
TYPE
COLOR_ATTRIBUTE_CHANGE
DESCRIPTION
Fires when color value changes. Carries value in detail variable.
NAME
Globals.borderRadiusChange
VALUE
BORDER_RADIUS_CHANGE
DESCRIPTION
Fires when border radius changes. Carries value in detail variable.
NAME
Globals.lightDarkModeClick
TYPE
LIGHT_DARK_MODE_CLICK
DESCRIPTION
Fires when the light/dark button clicked.
NAME
Globals.pinButtonClick
VALUE
PIN_BUTTON_CLICK
DESCRIPTION
Fires when the menu lock/unlock button clicked.
NAME
Globals.switchedToMobile
TYPE
SWITCHED_TO_MOBILE
DESCRIPTION
Fires when the menu/layout switches to mobile version.
NAME
Globals.switchedToDesktop
VALUE
SWITCHED_TO_DESKTOP
DESCRIPTION
Fires when the menu/layout switches to desktop version.

Caller

Settings.js is called in the scripts.js file.