package incr_dom
Module Incr_dom.Js_miscSource
This module has a small collection of helpful bits of javascript that have no other obvious home.
viewport_rect () gives you the rectangle that corresponds to the size of the entire browser window
viewport_rect_of_element el gives you the bounding box rectangle for a single element
client_rect () gives you the rectangle that corresponds to the size of the entire browser window without the scroll bars.
client_rect_of_element el gives you the inner box rectangle for a single element, not including its scroll bars if it has any.
Returns true iff the element in question is in view.
Find an element with an id (default as "keep-in-view"), and, if it exists, scrolls the UI so that that element is in view.
val find_visible_range :
length:int ->
nth_element_id:(int -> string) ->
rows_or_columns ->
(int * int) optionfind_visible_range ~length ~nth_element_id layout is useful to find visible rows or columns of a table. The time cost is O(log(length)). It assumes the rows/columns are non-overlapping and arranged monotonically, though the order doesn't matter. It's assumed that the rows are laid out from 0 to length - 1.
If no row is visible, then None is returned. Otherwise, the inclusive upper and lower bounds of the visible rows are returned.
val get_scroll_container :
Js_of_ocaml.Dom.node Js_of_ocaml.Js.t ->
Js_of_ocaml.Dom.node Js_of_ocaml.Js.tscroll_container node finds the closest scrollable ancestor in the DOM tree. If there is no scrollable element above the node passed in, then the document will be returned