MCPcopy Create free account
hub / github.com/angular/components / _addStickyStyle

Method _addStickyStyle

src/cdk/table/sticky-styler.ts:385–400  ·  view source on GitHub ↗

* Adds the sticky styling to the element by adding the sticky style class, changing position * to be sticky (and -webkit-sticky), setting the appropriate zIndex, and adding a sticky * direction and value.

(
    element: HTMLElement,
    dir: StickyDirection,
    dirValue: number,
    isBorderElement: boolean,
  )

Source from the content-addressed store, hash-verified

383 * direction and value.
384 */
385 _addStickyStyle(
386 element: HTMLElement,
387 dir: StickyDirection,
388 dirValue: number,
389 isBorderElement: boolean,
390 ) {
391 element.classList.add(this._stickCellCss);
392 if (isBorderElement) {
393 element.classList.add(this._borderCellCss[dir]);
394 }
395 element.style[dir] = `${dirValue}px`;
396 element.style.zIndex = this._getCalculatedZIndex(element);
397 if (this._needsPositionStickyOnElement) {
398 element.style.cssText += 'position: -webkit-sticky; position: sticky; ';
399 }
400 }
401
402 /**
403 * Calculate what the z-index should be for the element, depending on what directions (top,

Callers 3

updateStickyColumnsMethod · 0.95
stickRowsMethod · 0.95

Calls 2

_getCalculatedZIndexMethod · 0.95
addMethod · 0.45

Tested by

no test coverage detected