I'm trying to get current styles from a live preview when Customizer is loaded to set them in my controls. How can I do that?
I was trying in this way:
but it returns 'undefined', so as I think contents() loads only DOM without any styles.
Is there any suitable function in WP Customizer which I can use to get style values and set them in my controls?
Example: I've created control to change font-size and I used Slider UI to achieve it. Here is my problem. When I open Customizer, the slider is setted to 0. It doesn't make any sense, because font-size (i.e. for body) on my website is 13px, so the slider should also be setted to 13, not 0.
To solve my problem I would like to get the current body font-size from my website and set it to the slider. I don't know, maybe there is a better solution. I hope it's clear now.
Thanks for your help!