Saturday, May 25, 2024
 Popular · Latest · Hot · Upcoming
74
rated 0 times [  80] [ 6]  / answers: 1 / hits: 140203  / 9 Years ago, tue, december 29, 2015, 12:00:00

I love this library. I'd like to use it to display a moderate response table on one of my web pages, but the text gets a little wide. I was hoping there was an option to change the width of the overall alert for the page that I'm displaying the table within SweetAlert, but I'm not having any luck. Table & HTML look great, just too much info for the modal.



I can't even find where the width is set in the overall sweetalert.css.



I thought maybe the customClass configuation key might help and I tried:



swal({
title: priorityLevel +' Issues for '+appName,
html: appHTML,
type: info,
customClass: 'swal-wide',
showCancelButton: true,
showConfirmButton:false
});


The css was just a simple:



.swal-wide{
width:850px;
}


This didn't do anything. Anyone have an idea of how to do this or perhaps have played around with the width element?



Thank you!


More From » html

 Answers
2

try to put !important like this in the css:



.swal-wide{
width:850px !important;
}


See it working in the snippet.



function TestSweetAlert(){
swal({
title: 1 +' Issues for test',
text: A custom <span style='color:red;'>html</span> message.,
html: true,
type: info,
customClass: 'swal-wide',
showCancelButton: true,
showConfirmButton:false
});
};

$('#testeSWAL').on(click,TestSweetAlert);

.swal-wide{
width:850px !important;
}

<script src=https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js></script>
<script src=https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.js></script>
<link href=https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.css rel=stylesheet/>


<button id=testeSWAL> Test SWAL </button>






Note: maybe you will have problems with the position.



[#63900] Sunday, December 27, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
draven

Total Points: 641
Total Questions: 101
Total Answers: 110

Location: Nicaragua
Member since Mon, Sep 26, 2022
2 Years ago
;