Re-position element once its dimension is known

41 views
Skip to first unread message

Jacky See

unread,
Oct 20, 2016, 4:08:55 AM10/20/16
to Elm Discuss
I'm doing some dropdown UI where I would like to re-calculate position of the element once it appeared on screen.
Something like http://github.hubspot.com/drop/docs/welcome/

While I can get the triggering element position on click, I'm thinking how should get the offsetWidth/offsetHeight
of the dropdown once it is shown and feed it back to update again. Any idea?

Erkal Selman

unread,
Oct 20, 2016, 9:04:42 AM10/20/16
to Elm Discuss
Instead of getting the position, why not putting the dropdown menu into the same div with its button?

Jacky

unread,
Oct 20, 2016, 9:50:40 AM10/20/16
to elm-d...@googlegroups.com
You still need to do edge detection.
e.g. the dropdown is originally displayed below the button,
when the button is near the page bottom, the dropdown need to be above instead.

--
You received this message because you are subscribed to a topic in the Google Groups "Elm Discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elm-discuss/BS0YEAb9SaU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elm-discuss+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Best Regards,
Jacky See
Reply all
Reply to author
Forward
0 new messages