EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: neos on April 01, 2016, 01:16:49 AM



Title: [SOLVED]Better way to change Backround color for messager.show
Post by: neos 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


Title: Re: Better way to change Backround color for messager.show
Post by: stworthy 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>


Title: [SOLVED]Better way to change Backround color for messager.show
Post by: neos 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


Title: Re: [SOLVED]Better way to change Backround color for messager.show
Post by: aswzen 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:''
            }
        });


Title: Re: [SOLVED]Better way to change Backround color for messager.show
Post by: stworthy 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'
        });