Warning: Reason support is experimental. We are looking for beta-tester and contributors.

Module Ot_noderesize

module Ot_noderesize : sig..end

Get an event when an element's size changes

Known issues

This only work with elements in the DOM (maybe that the element has to be displayd, need to check this). In case of a content loaded dynamically with js, watch a parent already thereif possible or use a onnodeready event to attach noderesize listener.

If the element to be watched is not positionned, a position: relative will be applied.

Example

Lwt.async (fun () ->
        let div' = (To_dom.of_element div) in
        let%lwt () = Nodeready.nodeready container' in
        Ot_noderesize.noderesize (Noderesize.init div) (fun () ->
          Firebug.console##log (Js.string "Resized") ) )

type resize_sensor
val attach : #Dom_html.element Js.t -> resize_sensor
val noderesize : resize_sensor -> (unit -> unit) -> unit
val detach : resize_sensor -> unit