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

170
Vistas
How to toggle layers of a map from mapbox in wix/velo?

I have a .html of a map from mapbox that should display in a page on a wix site. I want to change some layers visibility and I followed some tutorials, but I'm receiving this error message that don't show wherer de error is:

TypeError: Cannot read properties of undefined (reading 'getElementById').

Here's my code until now, hope someone can help me!!!

import mapboxgl from 'mapbox-gl';

var isMatch = new Boolean ([true]); 

$w.onReady(function () {
    
mapboxgl.accessToken = 

'pk.eyJ1Ijoiam9hb3BlZHJvdmdhIiwiYSI6ImNreGtqMHZxZTJwcTIzMHB6Y2lnMm00czkifQ.auBfiQMlyayVxRlHCPuPkQ';

const map = new mapboxgl.Map ({

    container: 'Basic',

    style: 'mapbox://styles/joaopedrovga/ckxkj2aon1xh314me52nin8w8'
});

$w('#au').onClick((event) =>{

if(isMatch)

    {
        $w('#img').hide();
        map.setLayoutProperty('water', 'visibility', 'none');
        isMatch = false; 
    }
    else{
        $w('#img').show();
        map.setLayoutProperty('water', 'visibility', 'visible');
        isMatch = true;
    }
});
});
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