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

103
Views
Add Loader until stl image load PHP

I am using Stl Viewer Javascript Plugin to display 3D image in my Website. The size of STL image is around 50MB. So, it is taking much time to load. So is it feasible to add loader image until the stl image load.

I am using this plugin, https://www.viewstl.com/plugin/

Please check my code below,

<body style="margin:0px;">
        <div id="stl_cont" style="width:600px;height:600px;margin:0; background:#ebebeb; overflow: hidden;"></div>

        <script src="stl_viewer.min.js"></script>       
        <script>
            var stl_viewer=new StlViewer
            (
                document.getElementById("stl_cont"),
                {
                    models:
                    [
                        {filename:"/test/Sienna.stl"}
                    ]
                }
            );
        </script>
        
    </body>

Please check the screenshot of the front-end, enter image description here

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I tried the code i pasted below and it is working fine on my local machine, please check and let me know if it's working for you also.

P.S please replace image element's source with an appropriate gif url to get it working

<body style="margin: 0px">
    <div
      id="stl_cont"
      style="
        width: 600px;
        height: 600px;
        margin: 0;
        background: #ebebeb;
        overflow: hidden;
      "
    >
      <div
        class="loading"
        style="
          width: 600px;
          height: 600px;
          display: flex;
          align-items: center;
          justify-content: center;
        "
      >
        <img src="./assets/images/icons8-dots-loading.gif" alt="" />
      </div>
    </div>

    <script src="stl_viewer.min.js"></script>
    <script>
      var stl_viewer = new StlViewer(document.getElementById("stl_cont"),
        {
          models: [
            { filename: "/test/Sienna.stl" }
          ],
          all_loaded_callback: function () {
            document.querySelector(".loading").remove();
          },
        }
      );
    </script>
  </body>

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