Fork me on GitHub
#hoplon
<
2016-09-22
>
jjttjj18:09:20

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?

alandipert18:09:12

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

jjttjj19:09:41

@alandipert yup that fixed it, thanks!