Created
January 14, 2016 19:42
-
-
Save netzwerg/d6fabd32aca27ed83e8b to your computer and use it in GitHub Desktop.
Mouse hover example to paste into http://www.elm-lang.org/try
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Graphics.Element exposing (..) | |
import Signal exposing (..) | |
import Graphics.Input exposing (hoverable) | |
main : Signal Element | |
main = | |
Signal.map view hover.signal | |
hover : Signal.Mailbox String | |
hover = Signal.mailbox "–" | |
size = 100 | |
yogi : Element | |
yogi = | |
image size size "/imgs/yogi.jpg" | |
|> hoverable (\ r -> if r then (Signal.message hover.address "yogi") else (Signal.message hover.address "–")) | |
view : String -> Element | |
view hover = | |
flow right | |
[ container size size middle yogi | |
, container size size middle (show hover) | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment