is-fixed.js
/**
* Detect whether element is placed to fixed container or is fixed itself.
*
* @module mucss/is-fixed
*
* @param {(Element|Object)} el Element to detect fixedness.
*
* @return {boolean} Whether element is nested.
*/
module.exports = function (el) {
var parentEl = el;
//window is fixed, btw
if (el === window) return true;
//unlike the doc
if (el === document) return false;
while (parentEl) {
if (getComputedStyle(parentEl).position === 'fixed') return true;
parentEl = parentEl.offsetParent;
}
return false;
};