一个很简单的Jqery弹出框

function playVoide(obj){
    var video = $(obj).attr("value");
    var width = $("#content").width();
    var height =  $("#content").height()-50;
    var tit = "查看视频内容";
    var path ="";
    var winWidth = $(window).width(),winHeight = $(document).height();
    $("body").append("<div class='winbj'></div>")
    $("body").append("<div class='tanchu' id='openDiv'><div class='tanChutit' >"+
                     "<span class='tanchuTxt'>"+tit+"</span><span class='tanchuClose' "+
                     "onclick='closeDiv();'>关闭</span></div><video style='width:100%' src='"+video+"' controls='controls' preload='none'></video></div>");
    $(".winbj").css({"width":winWidth,"height":winHeight,"background":"#000","position":"absolute","left":"0","top":"0"});
    $(".winbj").fadeTo(0,0.1);
    
    var tanchuLeft = $(window).width()/2-width/2;
    var tanchuTop = $(window).height()/2 - height/2+ $(window).scrollTop();
    $(".tanchu").css({"width":width,"height":height,"border":"1px #D1D1D1 solid","left":tanchuLeft,"top":tanchuTop,
                    "background":"#fff","position":"absolute"});
    $(".tanChutit").css({"width":width,"height":"35px","border-buttom":"1px #4D7FB7 solid","left":tanchuLeft,"top":tanchuTop,
                    "background":"url('"+path+"/static/images/bg_x.png') repeat-x scroll 0 -265px rgba(0, 0, 0, 0)","line-height":"35px"});
    $(".tanchuTxt").css({"text-indent":"5px","font-weight": "bold","float":"left","font-size":"13px","color":"black"});
    $(".tanchuClose").css({"width":"35px","float":"right","right": "2px","font-size":"12px","cursor":"pointer","height":"19px"});
    var winIframeHeight = height-26;
    $(".winIframe").css({"width":width,"height":winIframeHeight,"border-buttom":"1px #ccc solid","background":"#fffff"});
    $("#openDiv").hide();
    $("#openDiv").fadeIn(5);
}


function closeDiv(){
    $("#openDiv").fadeOut(500,outCallBack);
    //刷新页面 --局部刷新页面
}
function outCallBack(){
    $(".winbj").remove();
    $(".tanchu").remove();
}

function closeDivHover(type){
    if(type == 1){
        $(".tanchuClose").css("background","url('image/tipswindown_ico.png') no-repeat scroll 0 -30px transparent");
    }else{
        $(".tanchuClose").css("background","url('image/tipswindown_ico.png') no-repeat scroll -37px -30px transparent");
    }

}


猜你喜欢

转载自blog.csdn.net/u012325073/article/details/52294021