Window size global handler.
- Source:
Members
(static) breakpoint :string
Get breakpoint, based on pixels.
Type:
- string
- Deprecated:
- Yes
- Source:
(static) cssBreakpoint :string
Get cssBreakpoint, based on em.
Type:
- string
- Source:
Methods
(static) .currentBreakpoint(width) → {string}
Calculate current breakpoint, based on pixel width.
Parameters:
Name | Type | Description |
---|---|---|
width |
number | browser width in pixels |
- Deprecated:
- Yes
- Source:
Returns:
- the keyword for the breakpoint
- Type
- string
(static) .getWidthOfText(element) → {Number}
Work out the width of some text in pixels
by recreating it in a temporary span.
Parameters:
Name | Type | Description |
---|---|---|
element |
Node | an element that contains text |
- Source:
Returns:
width in px
- Type
- Number
(static) .greaterThan(width) → {Boolean}
Calculate if a breakpoint, based on pixel width, is greater than the
current browser width.
Parameters:
Name | Type | Description |
---|---|---|
width |
String | a breakpoint keyword |
- Deprecated:
- Yes
- Source:
Returns:
- true if the breakpoint is greater than the current browser width
- Type
- Boolean
(static) .resizeElementToContentWidth(element, padding)
Resize an element by setting its width to that of its inner text plus any extra that might be needed.
Parameters:
Name | Type | Description |
---|---|---|
element |
Node | an element |
padding |
Number | any extra padding to be added to the width |
- Source:
(static) .resizeTextFieldToFitContent(field, maxopt)
Resize a text input field by setting the size attribute
to the length of the value.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
field |
Node | an input field | ||
max |
Number |
<optional> |
50 | the maximum size |
- Source:
(static) .resizeThrottler()
Slow down the resize handler so we don't repaint too much.
Triggers a custom event which can be used instead of window.resize.
- Source:
(static) .scrollThrottler()
Slow down the scroll handler so we don't repaint too much.
Triggers a custom event which can be used instead of window.scroll.
- Source: