Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Klaus Kohlschuetter on Apr 13, 2009 03:39
open dhtmlx forum
Backgroundcolor in dtmlxWindows

Hi,

I'm using the pro version and have a problem with the background color using dhtmlXWindows. Here my code:

<script>
function CreateWindow( url, header ) {
    
    var winW = document.body.offsetWidth;
    var winH = document.body.offsetHeight;
    if ( dhxWins==null ){

        var dhxWins = new dhtmlXWindows();
        dhxWins.enableAutoViewport( false );
        dhxWins.vp.style.overflow = "auto";
        dhxWins.setViewport( 0, 0, winW, winH );
        dhxWins.setImagePath("../../dhtmlx/dhtmlxWindows/imgs/");
        dhxWins.setSkin("modern_blue");
        
        var w1 = dhxWins.createWindow("w1", 50, 50, 500, 500);
        w1.setText( header );
        w1.button("close").show();
        w1.button("help").hide();
        w1.button("park").hide();
    
        dhxWins.window("w1").attachEvent("onClose", function(){
            dhxWins.setViewport( 0, 0, 0,0 );
            dhxWins.close;
        });
    } else{
        dhxWins.setViewport( 0, 0, winW, winH );
    }
    //dhxWins.window("w1").clearIcon();
    dhxWins.window("w1").setModal(true);
    dhxWins.window("w1").attachURL( url , false);
    dhxWins.window("w1").center();
}
</script>

Using "dhxWins.window("w1").attachURL( url , false);" everything works fine, but the backgroundcolor of the window is allways white. Using "dhxWins.window("w1").attachURL( url , true);" the backgroundcolor is ok, but my defined stylesheet disappears.

What's wrong? Can you help me?
Thanks.
Answer posted by Alex (support) on Apr 13, 2009 05:43

Hello, 

Where is the background colour defined ?

In case of attachURL(url,true) the page content is loaded by Ajax. It means that the content is part of the page. That is why the styles, that are defined on the main page, are applied.

If you use attachURL(url,false) or attachURL(url), the page is loaded into iframe inside a window. So, the background colour must be defined also in the page you load into the window.

Answer posted on Apr 13, 2009 09:47
I'm using dhtmlxwindows_modern_blue.css and in that stylesheet the background color of the created window is light grey. Loading a html-file into the the window with its own stylesheet I would like to get the background transparent in order to use the predefined dhtmlx-background color. Setting the background to transaparent the background color appears always white.
Answer posted by Alex (support) on Apr 14, 2009 02:43

You can try to use the following approach:

<style>
 div.dhtmlx_wins_body_content{
  background-color: lightgrey !important;
 }
 div.dhtmlx_wins_body_content iframe{

/*here you can set the necessary opacity*/
  filter:alpha(opacity=50);
  -moz-opacity:0.5;
  opacity:0.5;
 }
</style>