fysiweb/elm-gallery/1.0.0

Gallery

View

-> State
-> List Controls
-> List ( String, Html Msg )
-> Html Msg
Gallery.view config model.gallery [] slides

Configuration

type Config
{ id : String
, transition : Int
, width : Length
, height : Length
}
-> Config
 Gallery.config
    { id = "image-gallery"
    , transition = 500 -- time in milliseconds
    , width = Gallery.px 800
    , height = Gallery.px 400
    }

Dimensions

type Length
px : Float -> Length
pct : Float -> Length
rem : Float -> Length
em : Float -> Length
vw : Float -> Length
vh : Float -> Length

State

init : SlideCount -> State

Initialize a gallery state

{ gallery = Gallery.init (List.length someSlides) }
type Msg
    = GalleryMsg Gallery.Msg


update : Msg -> Model -> Model
update msg model =
    case msg of
        GalleryMsg msg ->
            { model | gallery = Gallery.update msg model.gallery }

Definitions

type State

Tracks index, mouse and touch movements

type Msg

A message type for the gallery to update.

type alias SlideCount =
Int

Total number of slides

Controls

= Arrows

Navigation

index : Int -> State -> State

Go to slide at index

{ model | gallery = Gallery.index 10 model.gallery }
current : State -> Int

Get current index