Wednesday, 7 April 2010

Thickbox

So i've also been using the thickbox modal pop in java script to make nice modal boxes.Thickbox 3.1 here However my site is 900px wide and rather than covering the whole window I wanted it to simply cover the page.

To do this I added this to the css:

#TB_narrowbk {
    position: relative;
    z-index:102;
    top:0px;
    height:100%;
    width:900px;   
    margin-left: 100px;
    background-color:#000;
    filter:alpha(opacity=75);
    -moz-opacity: 0.75;
    opacity: 0.75;
}
and this to the java script

}else{//all others
            if(document.getElementById("TB_overlay") === null){
                $("body").append("
"); <-- modified this
                $("#TB_overlay").click(tb_remove);
                $("#TB_narrowbk").click(tb_remove); <-- added this
            }
        }
I can't be bothered to make it work with ie6. Damn ie6.

1 comment:

  1. actually I used margin:auto; to center the div

    ReplyDelete