Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

129
Views
Reinitializing CSS-Element-Queries after an ajax call

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.

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

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>");
about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!