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

233
Views
Image isn't being loaded on my hosted website but works fine through VScode live server

So I have just hosted my first website through fastHosts and 99% is working except for this one image that should appear through Javascript when the menu is opened:Menu closedMenu Open

This is what it looks like on VScode live server, working as intended, but on my hosted website with the exact same files the 'X' when menu is opened doesnt appear, but you can still click the area for it to close.

Here is the Script function that is called on click:

function toggle() {
    const visible = navItems.getAttribute('data-visible')

    if (visible === "false") {
        navItems.setAttribute("data-visible", "true")
        navButton.setAttribute("data-open", "true")
    } else if (visible === "true") {
        navItems.setAttribute("data-visible", "false")
        navButton.setAttribute("data-open", "false")
    }
}

This function also allows the menu to open and close which is still working on the website.

This is the CSS:

.mobile-nav-button[data-open="true"] {
        background: url(../Images/X.png);
        background-repeat: no-repeat;
    }

It was originally toggled with an aria attribute which I tried changing to a data attribute instead and I have also tried other images but no luck.

The only difference is the hosted website is an index.php and the VScode live server is with index.html as I havent figured out how to locally host it when it is a php file yet. The php code on the site is only for a form that doesnt have anything to do with the button.

Thank you and let me know if you need anything else! :)

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!