Home › Forums › JavaScript › Adjust content margin when div doesn’t exist › Reply To: Adjust content margin when div doesn’t exist
Yes, unfortunately the codepen you provided isn’t really helpful. Nevertheless, if you want to check the presence of some elements after the loading script of the sponsored elements, then you will need to have an event which tells you that the loading script of that sponsoring is done.
By default you can assume the HTML of the sponsored block is not in there, do something with that situation.
Then, on the event triggered by the sponsoring, you can have a function which checks the HTML and do something with that situation.
Question is, is there a load event or ready event or something like that in the script that load the content of your sponsors?
If not, maybe you can use something like mutation observer for detecting the changes. Use it on the element where the content of the sponsor gets appended to.