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

1.6K
Views
¿Cómo cambio la propiedad css hover del botón Sweet Alert?

Quiero cambiar la propiedad :hover del botón de confirmación de alerta dulce. Escribí el siguiente código:

 sweetAlert({ title: "<span style='color: #134563'>[My title]", text: "<span style='font-size: 20px'>[My Message.....]", imageUrl: "images/email-icon.png", allowOutsideClick: false, confirmButtonColor: "#134563", customClass: ".sweet-alert button:hover{ background:'#2b5c79'; -webkit-transition: all 0.3s ease-in-out; transition: all 0.3s ease-in-out; }", html: true });

Pero no obtengo la propiedad :hover incluso con la personalización de clase. ¿Cómo puedo solucionar eso?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Actualizar

Debe definir customClass como esto: customClass: ".sweet-alert button" . Ahora puede definir los estilos en su hoja de estilo (css) como .sweet-alert button:hover{ background:'#2b5c79'; -webkit-transition: all 0.3s ease-in-out; transition: all 0.3s ease-in-out; } . Sé que el fragmento no funciona, solo tiene fines ilustrativos. Puede encontrar la documentación aquí o docu sweetalert2 (se dan ejemplos).

 sweetAlert({ title: "<span style='color: #134563'>[My title]", text: "<span style='font-size: 20px'>[My Message.....]", imageUrl: "images/email-icon.png", allowOutsideClick: false, confirmButtonColor: "#134563", customClass: ".sweet-alert button", html: true });
 .sweet-alert button:hover { background:'#2b5c79'; -webkit-transition: all 0.3s ease-in-out; transition: all 0.3s ease-in-out; }


Respuesta antigua

Puedes probar esto. Agregue estos eventos a su botón, simula el evento flotante.

 $(".myclass").mouseover(function() { $(this).css("background-color","red"); }).mouseout(function() { $(this).css("background-color","transparent"); });
 .myclass { height: 50px; width: 100%; }
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="myclass"></div>

over 4 years ago · Santiago Trujillo Report

0

Puede usar jquery para apuntar al botón directamente:

 $(".swal2-confirm.swal2-styled").on('mouseenter', function() {$(this).css('background', 'green')})

resultado :

ingrese la descripción de la imagen aquí

Para configurar el color al salir:

 $(".swal2-confirm.swal2-styled").on('mouseleave', function() {$(this).css('background', 'blue')})
over 4 years ago · Santiago Trujillo Report
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!