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.
Also, if the element is removed, then re-inserted in the DOM, sensor will not work anymore.
If the element to be watched is not positionned, a position: relative will be applied.
Lwt.async (fun () -> let div' = (To_dom.of_element div) in let%lwt () = Ot_nodeready.nodeready div' in Ot_noderesize.noderesize (ot_noderesize.attach div) (fun () -> Firebug.console##log (Js.string "Resized") ) )
val attach : #Dom_html.element Js.t -> resize_sensor
val noderesize : ?safe:bool -> resize_sensor -> (unit -> unit) -> unit
When safe is set to true, noderesize will work whatever sized is the watched element. When set to false (which is the default), elements bigger than 9999px (width or height) will not detect resize, but noderesize will be more efficient (less computation/reading).
val detach : resize_sensor -> unit