package ocsigen-toolkit

  1. Overview
  2. Docs
Reusable UI components for Eliom applications (client only, or client-server)

Install

dune-project
 Dependency

Authors

Maintainers

Sources

4.3.0.tar.gz
md5=69be960fcd9bd4980c97ec2abebedc80
sha512=f1d76fc73046f9d577cdcaa85adf3e372995d924a6cbbd1bb189e294d717bc35c1d9cda3701189a4436c2d45fc8ddc2a16f8198182ac071fd501bb7d882a2276

doc/ocsigen-toolkit.server/Ot_swipe/index.html

Module Ot_swipe

val bind : ?transition_duration:float -> ?min:(unit -> int) Eliom_client_value.t -> ?max:(unit -> int) Eliom_client_value.t -> compute_final_pos: (Js_of_ocaml.Dom_html.touchEvent Js_of_ocaml.Js.t -> int -> int) Eliom_client_value.t -> ?onstart: (Js_of_ocaml.Dom_html.touchEvent Js_of_ocaml.Js.t -> int -> unit) Eliom_client_value.t -> ?onmove: (Js_of_ocaml.Dom_html.touchEvent Js_of_ocaml.Js.t -> int -> unit) Eliom_client_value.t -> ?onend: (Js_of_ocaml.Dom_html.touchEvent Js_of_ocaml.Js.t -> int -> unit) Eliom_client_value.t -> Html_types.div_content Eliom_content.Html.elt -> unit

bind ~compute_final_pos elt makes elt left-right swipable on touch screens. compute_final_pos is a function that will compute the final position of the element w.r.t. the position where it has been released (in pixels). Use (fun _ p -> p) if you want it to stay where it was released.

Use ?min and ?max if you want to limit the move. If outside range, events will be propagated to parent (which makes it possible to have a swipeable element inside another one).

?onstart and ?onmove and ?onend can be used to execute some side effect on touch start, touch move and touch end. The second parameter is the current move.