Here's code for an onScroll function that can be used just like an Html.Events.onClick. Basically, you can always use a Decoder with Html.Events.on to listen to HTML events this way:
type alias ScrollEvent =
{ scrollHeight : Int
, scrollPos : Int
, visibleHeight : Int
}
onScroll : (ScrollEvent -> msg) -> Html.Attribute msg
onScroll tagger =
Html.Events.on "scroll" (Decode.map tagger onScrollJsonParser)
onScrollJsonParser : Decode.Decoder ScrollEvent
onScrollJsonParser =
Decode.map3 ScrollEvent
(Decode.at ["target", "scrollHeight"] Decode.int)
(Decode.at ["target", "scrollTop"] Decode.int)
(Decode.at ["target", "clientHeight"] Decode.int)