Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

236
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda