I'm using css-element-queries (https://github.com/marcj/css-element-queries) to apply styles based on the element's size, but I'm also dynamically adding elements via an ajax call. Elements loaded via ajax are not being styled properly, presumably because they aren't present when the css-element-queries script is executed. css-element-queries runs automatically on window.load so I'm unclear on how to get it to run after the ajax call is successful. I'm using jquery, so jquery-specific responses are welcome.
css-element-queries has a work around.
https://github.com/marcj/css-element-queries/issues/31
It is possible to force the window.load event,
dispatchEvent(new Event('load'));
but it is deprecated and could circle your Ajax into a loop, unless your ajax is not being done by the onload event. IE Old school netscape 2, document.write method.
document.write("<script src='ajax.js'><"+"/"+"script>");