2

I am using Clojurescript Om and I need to access the underlying DOM element (so that I can set offsetTop to 0) on one of the DIVs contained in a component. How can I get access to this element?

yazz.com
  • 57,320
  • 66
  • 234
  • 385

1 Answers1

6

You can use get-node. There is an example available here.

Note that the component must be already mounted in order to access its DOM element, therefore you should invoke get-node in one of the Om lifecycle methods that are invoked after the component is mounted (e.g. did-mount).

If you are using om.next, then you should use the node function instead.

Symfrog
  • 3,398
  • 1
  • 17
  • 13