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
How to access : :before element

I have use viwerJs for show the images. when I going to access the Css in my project I wanted to use javascript for that. So my problem was when I going to do fowllowing process I couldn't access ::before element to set the margin

here is the code I can do in css but i want to do thi in JS.

    .viewer-toolbar > ul > li::before{
  margin: 10px 0px 0px 10px !important;
}

.viewer-play::before {
    background-position: -97px 3px !important;
 } 

here is my try

 viewImage(event) {
    let viewer = new Viewer(event.currentTarget, {
      navbar: false,
      viewed() {
        debugger
        viewer.zoomTo(2);

        viewer['image'].style['border'] = "1px solid white";
        
        for (let t = 0; t < viewer['toolbar'].childNodes[0].childNodes.length; t++){
          let li = viewer['toolbar'].childNodes[0].childNodes[t];

          if(li.className === 'viewer-play viewer-large'){

            li.style.width = '46px';
            li.style.height = '46px';
            li.before.style.margin = '10px 0px 0px 10px'; // this my try but it not work

          }else{

            li.style.width = '40px';
            li.style.height = '40px';

          }
          
        }
      }

    });

    viewer.show();
  }

Click here to see the jsfiddle

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