Mixin: ClippableElement

.ui.mixin.ClippableElement

Element that can be automatically clipped to visible boundaries.

Whenever the element's natural height changes, you have to call OO.ui.mixin.ClippableElement#clip to make sure it's still clipping correctly.

The dimensions of #$clippableContainer will be compared to the boundaries of the nearest scrollable container. If #$clippableContainer is too tall and/or too wide, then #$clippable will be given a fixed reduced height and/or width and will be made scrollable. By default, #$clippable and #$clippableContainer are the same element, but you can build a static footer by setting #$clippableContainer to an element that contains

#$clippable and the footer.

Source:

Methods

clip()

Clip element to visible boundaries and allow scrolling when needed. You should call this method when the element's natural height changes.

Element will be clipped the bottom or right of the element is within 10px of the edge of, or overlapped by, the visible area of the nearest scrollable container.

Because calling clip() when the natural height changes isn't always possible, we also set max-height when the element isn't being clipped. This means that if the element tries to grow beyond the edge, something reasonable will happen before clip() is called.

Source:

getHorizontalAnchorEdge() → {string}

Return the side of the clippable on which it is "anchored" (aligned to something else). ClippableElement will clip the opposite side when reducing element's width.

Classes that mix in ClippableElement should override this to return 'right' if their clippable is absolutely positioned and using 'right: Npx' (and not using 'left'). If your class also mixes in FloatableElement, this is handled automatically.

(This can't be guessed from the actual CSS because the computed values for 'left'/'right' are always in pixels, even if they were unset or set to 'auto'.)

When in doubt, 'left' (or 'right' in RTL) is a sane fallback.

Source:
Returns:

'left' or 'right'

Type
string

getVerticalAnchorEdge() → {string}

Return the side of the clippable on which it is "anchored" (aligned to something else). ClippableElement will clip the opposite side when reducing element's width.

Classes that mix in ClippableElement should override this to return 'bottom' if their clippable is absolutely positioned and using 'bottom: Npx' (and not using 'top'). If your class also mixes in FloatableElement, this is handled automatically.

(This can't be guessed from the actual CSS because the computed values for 'left'/'right' are always in pixels, even if they were unset or set to 'auto'.)

When in doubt, 'top' is a sane fallback.

Source:
Returns:

'top' or 'bottom'

Type
string

isClipped() → {boolean}

Check if the bottom or right of the element is being clipped by the nearest scrollable container.

Source:
Returns:

Part of the element is being clipped

Type
boolean

isClippedHorizontally() → {boolean}

Check if the right of the element is being clipped by the nearest scrollable container.

Source:
Returns:

Part of the element is being clipped

Type
boolean

isClippedVertically() → {boolean}

Check if the bottom of the element is being clipped by the nearest scrollable container.

Source:
Returns:

Part of the element is being clipped

Type
boolean

isClipping() → {boolean}

Check if the element will be clipped to fit the visible area of the nearest scrollable container.

Source:
Returns:

Element will be clipped to the visible area

Type
boolean

setClippableContainer($clippableContainer)

Set clippable container.

This is the container that will be measured when deciding whether to clip. When clipping,

#$clippable will be resized in order to keep the clippable container fully visible.

If the clippable container is unset, #$clippable will be used.

Parameters:
Name Type Description
$clippableContainer jQuery | null

Container to keep visible, or null to unset

Source:

setClippableElement($clippable)

Set clippable element.

If an element is already set, it will be cleaned up before setting up the new element.

Parameters:
Name Type Description
$clippable jQuery

Element to make clippable

Source:

setIdealSize(widthopt, heightopt)

Set the ideal size. These are the dimensions #$clippable will have when it's not being clipped.

Parameters:
Name Type Attributes Description
width number | string <optional>

Width as a number of pixels or CSS string with unit suffix

height number | string <optional>

Height as a number of pixels or CSS string with unit suffix

Source:

toggleClipping(clippingopt)

Toggle clipping.

Do not turn clipping on until after the element is attached to the DOM and visible.

Parameters:
Name Type Attributes Description
clipping boolean <optional>

Enable clipping, omit to toggle

Source: