Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

232
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda