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

137
Views
Modal behaviour -how can I change this code to pull in dynamic content and improve page speed?

I've taken over a site build that has modals hard coded into the template. All is good apart from these modals which are causing slow page speed results - I think because each modal is loading in an iFrame from a platform that seems to have slow loading forms and extra scripts etc.

I'm looking for a way to tweak the code that is there currently so that it loads in the modal content dynamically rather than it just being on every page and hidden by CSS. I'm not really a coder, but I'm pretty sure that this is a very clumsy way of doing it and can be streamlined significantly!

I've extracted the relevant code and put it here:

https://codepen.io/Patz/pen/oNwPJve

<div id="cta-contactus" class="modal">
    
    <div class="modal-content">
        <span class="close">&times;</span>
        <!--[if lte IE 8]>
        <script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2-legacy.js"></script>
        <![endif]-->
        <script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2.js"></script>
    </div>
</div>

Perhaps these forms could be embedded in external iFrames so that they are not on the page by default, but I think this could also not be the best way of achieving this! Any tips much appreciated :)

about 4 years ago · Juan Pablo Isaza
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!