Skip to main content

init_ex_with_element

Function init_ex_with_element 

Source
pub fn init_ex_with_element(
    root: Element,
    pos: (i32, i32),
    size: Option<(u32, u32)>,
) -> Result<(), DivError>
Expand description

Extended initialization function. Mounts a global div as a child of the element provided. The specified dimensions restrict the area in which divs are visible.

ยงExample

let width = 1280;
let height = 720;
let root = web_sys::window().unwrap().document().unwrap().get_element_by_id("my-root-id").unwrap();
div::init_ex_with_element(root, (0, 0), Some((width, height)));