Skip to content

Commit

Permalink
Fixed Data Scrollers example
Browse files Browse the repository at this point in the history
Use CSS classes on container and inner-scroll-surface. Fix invalid rootMargin.
  • Loading branch information
carlosagsmendes committed Apr 22, 2016
1 parent d57aeff commit 89ed2bf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions explainer.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ We can use an `IntersectionObserver` on child elements of a parent scrolling ele
}
</style>

<div id="container">
<div id="inner-scroll-surface">
<div class="container">
<div class="inner-scroll-surface">
<div class="scroll-item" style="top: 0em;">item 1</div>
<div class="scroll-item" style="top: 2em;">item 2</div>
<div class="scroll-item" style="top: 4em;">item 3</div>
Expand All @@ -186,7 +186,7 @@ function init() {
// Notify when a scroll-item gets within, or moves beyond, 500px from the visible scroll surface.
var observer = new IntersectionObserver(manageItemPositionChanges,
{ root: document.querySelector(".container"),
rootMargin: "500px 0" });
rootMargin: "500px 0px" });
// Set up observer on the items
query(".inner-scroll-surface > .scroll-item").forEach(function(scrollItem) {
observer.observe(scrollItem);
Expand Down

0 comments on commit 89ed2bf

Please sign in to comment.