Skip to content

Commit d4ce8fd

Browse files
author
Sébastien
committed
Use window height and width instead of document ones
1 parent e7e3ea9 commit d4ce8fd

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/widgets/ot_tip.eliom

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,16 @@ let%client display ?(container_a = [a_class ["ot-tip-container"]])
4242
@@ (div ~a:[a_class ["ot-tip-src"]] [] :: content (fun () -> !close ()))
4343
in
4444
let container_elt = To_dom.of_element container in
45-
let d_height = float Dom_html.document##.documentElement##.clientHeight in
46-
let d_width = float Dom_html.document##.documentElement##.clientWidth in
45+
let d_height =
46+
float
47+
@@ Js.Optdef.get Dom_html.window##.innerHeight
48+
@@ fun () -> Dom_html.document##.documentElement##.clientHeight
49+
in
50+
let d_width =
51+
float
52+
@@ Js.Optdef.get Dom_html.window##.innerWidth
53+
@@ fun () -> Dom_html.document##.documentElement##.clientWidth
54+
in
4755
let o_bounds = origin##getBoundingClientRect in
4856
let o_left = o_bounds##.left in
4957
let o_right = o_bounds##.right in

0 commit comments

Comments
 (0)