MCPcopy Create free account
hub / github.com/ampproject/amphtml / isPositionFixed

Function isPositionFixed

src/ad-helper.js:27–31  ·  view source on GitHub ↗

* Determines if an element is fixed-positioned. * OK to use, because it's only called from onLayoutMeasure * @param {!Element} el * @param {!Window} win * @return {boolean}

(el, win)

Source from the content-addressed store, hash-verified

25 * @return {boolean}
26 */
27function isPositionFixed(el, win) {
28 const {position} = computedStyle(win, el);
29 // We consider sticky positions as fixed, since they can be fixed.
30 return position == 'fixed' || position == 'sticky';
31}
32
33/**
34 * @param {!Element} element

Callers 1

isAdPositionAllowedFunction · 0.85

Calls 1

computedStyleFunction · 0.90

Tested by

no test coverage detected