positionsticky.js 933 B

123456789101112131415161718192021222324252627
  1. /*!
  2. {
  3. "name": "CSS position: sticky",
  4. "property": "csspositionsticky",
  5. "tags": ["css"],
  6. "builderAliases": ["css_positionsticky"],
  7. "notes": [{
  8. "name": "Chrome bug report",
  9. "href":"https://bugs.chromium.org/p/chromium/issues/detail?id=322972"
  10. }],
  11. "warnings": ["using position:sticky on anything but top aligned elements is buggy in Chrome < 37 and iOS <=7+"]
  12. }
  13. !*/
  14. define(['Modernizr', 'createElement', 'prefixes'], function(Modernizr, createElement, prefixes) {
  15. // Sticky positioning - constrains an element to be positioned inside the
  16. // intersection of its container box, and the viewport.
  17. Modernizr.addTest('csspositionsticky', function() {
  18. var prop = 'position:';
  19. var value = 'sticky';
  20. var el = createElement('a');
  21. var mStyle = el.style;
  22. mStyle.cssText = prop + prefixes.join(value + ';' + prop).slice(0, -prop.length);
  23. return mStyle.position.indexOf(value) !== -1;
  24. });
  25. });