I am a starter ClojureScript developer, making a front-end application, and so far I didn't have to use Javascript, because reagent is more than enough. But now I want to implement some Jquery for an easy scrollAnimation. Jayq is working, but I have problems with using the interop.
$("#button").click(function() {
$('html, body').animate({
scrollTop: $("#elementtoScrollToID").offset().top
}, 2000);
});
So far I could manage to write the first part, where I get the position of the div I want to scroll to.
(.-top (.offset ($ "#scrollto")))
But the second part is harder then I thought. I tried it like below and some similar solutions, which also didn't work.
#(.animate ($ "html" "body") (clj->js {"scrollTop" (.-top (.offset ($ "#scrollto")))
}) "2000")
Any help is appreciated!