Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
rl-king committed Nov 5, 2018
1 parent e70e725 commit b4d168a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Detect if an element is in the current viewport
[example live](https://rl-king.github.io/elm-inview-example/) |
[example code](https://github.com/rl-king/elm-inview-example)

<img src="https://rl-king.github.io/elm-inview-example/illustrations/All.svg">
<img style="width=100%;" src="https://rl-king.github.io/elm-inview-example/illustrations/All.svg">

Since there is currently no way of listening to scroll events in Elm you'll have to hookup a port. Below is the bit of JS that gets you the scroll position and an example on how to set it all up.

Expand Down Expand Up @@ -54,7 +54,11 @@ update msg model =
)

InViewMsg inViewMsg ->
( { model | inView = InView.update inViewMsg model.inView }
, Cmd.none
let
( inView, inViewCmds ) =
InView.update inViewMsg model.inView
in
( { model | inView = inView }
, Cmd.map InViewMsg inViewCmds
)
```

0 comments on commit b4d168a

Please sign in to comment.