Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change icon image size on SweetAlert

I'm trying for change icon image size on SweetAlert. In the .css file I see:

.sweet-alert .sa-icon {
    width: 80px;
    height: 80px;
    border: 4px solid gray;
    -webkit-border-radius: 40px;
    border-radius: 40px;
    border-radius: 50%;
    margin: 20px auto;
    padding: 0;
    position: relative;
    box-sizing: content-box; }

I have changed this values:

 width: 80px;
 height: 80px;

But not change nothing. My .png file is showed in a predefinite size. Suggestions?


2 Answers

use the "imageSize" object class in your controller.

  swal({  title: "Oops...",
          text: "Please have a title and body in your post.",
          imageUrl: "../../../img/oopsface.png",
          imageSize: '600x600'
  });

(if you want to modify your sweet alert in this way, you need to use this formatting to call the alert)

like image 149
Jameela Huq Avatar answered Sep 11 '25 03:09

Jameela Huq


'imageHeight' for image height and 'imageWidth' for image width

swal({        
    title: 'Alert!',        
    text: 'Content',        
    imageUrl: 'assets/images/user.png',        
    imageHeight: 80, 
    imageWidth: 80,       
    imageClass:'img-responsive rounded-circle',        
    animation: false        
});
  1. 'title' for alert title
  2. 'text' for alert content
  3. 'imageUrl' for embed image url from website
  4. 'imageHeight' for image size(height)
  5. 'imageWidth' for image size(width)
  6. 'imageClass' for your custom image class/other class added

HTML Output like

<img src="assets/images/user.png" class="img-responsive rounded-circle" height="80" width="80" >

like image 36
yekyawaung Avatar answered Sep 11 '25 04:09

yekyawaung