EasyUI Forum
September 14, 2025, 12:11:41 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: [SOLVED]Better way to change Backround color for messager.show  (Read 14439 times)
neos
Newbie
*
Posts: 31


View Profile
« on: April 01, 2016, 01:16:49 AM »

Dear All,

How to change background color for messager.show
I use default blue style but for this case error notif i want to override change color to red

Regards,

Neos
« Last Edit: April 04, 2016, 06:09:54 PM by neos » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: April 01, 2016, 08:44:19 AM »

Please refer to the code below:
Code:
<style type="text/css">
.bg1{
background: red;
}
.bg1 .panel-title{
color:#fff;
}
</style>
<script>
$(function(){
var win = $.messager.show({
title:'My Title',
msg:'Message will be closed after 4 seconds.',
showType:'show'
});
win.window('window').addClass('bg1');
});
</script>
Logged
neos
Newbie
*
Posts: 31


View Profile
« Reply #2 on: April 04, 2016, 06:09:30 PM »

Thx Stworthy..
i will try your code..
yesterday i found this code :
Code:
$.messager.show({
                        title   : 'Info',
                        msg     : '<div class="messager-icon messager-error"></div><div>Failed !</div>'+result.error
                    });
this is enough for me to close my problem.
Regards,

Neos
Logged
aswzen
Sr. Member
****
Posts: 287


Indonesian

aswzen
View Profile WWW Email
« Reply #3 on: August 02, 2016, 02:54:23 AM »

Please refer to the code below:
Code:
<style type="text/css">
.bg1{
background: red;
}
.bg1 .panel-title{
color:#fff;
}
</style>
<script>
$(function(){
var win = $.messager.show({
title:'My Title',
msg:'Message will be closed after 4 seconds.',
showType:'show'
});
win.window('window').addClass('bg1');
});
</script>

is there any simple way than injecting a new css class?
like this one? (not working)
Code:
$.messager.show({
            width:'500px',
            height:'40px',
            msg:'<div style="text-align:center;padding:1px;font-size:20px">TEST</div>',
            timeout:4000,
            showType:'slide',
            style:{
                borderColor:'#808080',
                backgroundColor:'#222222',  
                color:'#FFFFFF',  
                right:'',
                top:document.body.scrollTop+document.documentElement.scrollTop,
                bottom:''
            }
        });
« Last Edit: August 02, 2016, 02:57:44 AM by aswzen » Logged

Regards,
Sigit

- Indonesian jEasyUI Facebook page : https://www.facebook.com/groups/jeasyuiid/
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #4 on: August 02, 2016, 07:03:15 PM »

You just need to set the 'cls' property value.
Code:
$.messager.show({
            width:500,
            height:40,
            msg:'<div style="text-align:center;padding:1px;font-size:20px">TEST</div>',
            timeout:4000,
            showType:'slide',
            cls:'c1'
        });
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!