study_car.js 1.0 KB
/*弹框*/
function tankuang(){
    var bh = $("body").height();
    var bw = $("body").width();
    $(".full_bg").css({
        height:bh,
        width:bw,
        display:"block"
    });
    var _scrollHeight = $(document).scrollTop(),//获取当前窗口距离页面顶部高度
        _windowHeight = $(window).height(),//获取当前窗口高度
        _windowWidth = $(window).width(),//获取当前窗口宽度
        _popupHeight = $('.yu_tan').height(),//获取弹出层高度
        _popupWeight = $('.yu_tan').width();//获取弹出层宽度
    posiTop = (_windowHeight - _popupHeight)/2 + _scrollHeight;
    posiLeft = (_windowWidth - _popupWeight)/2;
    $(".yu_tan").css({"left": posiLeft + "px","top":posiTop + "px","display":"block"});//设置position
    $("html").css("overflow","hidden");
    $("body").css("overflow","hidden");
    $(".yu_tan").show();
}
$('.cancel').click(function(){
    $("html").css("overflow","auto");
    $("body").css("overflow","auto");
    $(".full_bg").hide();
    $(".yu_tan").hide();
});