• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mozilla / blurts-server / #11898

pending completion
#11898

push

circleci

web-flow
Merge pull request #2770 from mozilla/license

Add license headers in source files

282 of 1138 branches covered (24.78%)

Branch coverage included in aggregate %.

959 of 3049 relevant lines covered (31.45%)

2.55 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/client/js/scroll-observer.js
1
/* This Source Code Form is subject to the terms of the Mozilla Public
2
 * License, v. 2.0. If a copy of the MPL was not distributed with this
3
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4

5
/**
6
* Detect when document has been scrolled.
7
* Uses IntersectionObserver for better performance over 'scroll' event.
8
* Hit area located above viewport (-1% top) with height of 1% (innerHeight px units did not work in Chrome)
9
*/
10

11
const observer = new IntersectionObserver(handleScroll, { rootMargin: '1% 0px -101% 0px' }) // hit area 1% height at -1% top
×
12

13
function handleScroll (entries) {
14
  entries.forEach((entry) => {
×
15
    switch (entry.target) {
×
16
      case document.body:
17
        document.documentElement.classList.toggle('scrolled', entry.isIntersecting)
×
18
        break
×
19
    }
20
  })
21
}
22

23
observer.observe(document.body)
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc