Fork me on GitHub

just getting my feet wet with hoplon/ui. I have a ui element x that i want to set the scrollTop to scrollHeight (so that it is scrolled to the bottom when the page loads). How do I do this?

(.log js/console x)
(.log js/console (.-scrollHeight (elems/in x)))
(set! (.-scrollTop (elems/in x))
                 (.-scrollHeight (elems/in x)))
in the above, in the first log output of the element i can look at the js console and see a positive scrollheight, but in the second line when i attempt to print the actual scrollHeight it shows as 0. I'm probably missing something fundamental here?


@jjttjj not a ui expert, but maybe you need to set those via (js/jQuery #(...)) aka document ready?


@alandipert yup that fixed it, thanks!