分类 javascript语言 下的文章

点击页面最前显示


快速写代码如下:

$(文档对象).ready(function () {
    $('.box-center').css('display','none');
    $('.weixin-show').css('margin','0 auto');
    var oDivH = $(document).height();
    $('.weixin').click(function () {
        $('.box-center').css({
            'width':'100%',
            'z-index':99,
            'top':0,
            'left':0,
            'height':oDivH,
            'position':'fixed',
            'background':'rgba(0,0,0,0.4)',
            'align-items':'center',
            'display':'flex'
        });
    });
    $('.box-center').click(function () {
        $('.box-center').hide();
    });
    var weixin = document.getElementsByClassName('weixin-show')[0];
    weixin.onclick = function (evt) {
        evt = evt || window.event;
        //js阻止事件冒泡
        if (evt.stopPropagation) {        //W3C
            evt.stopPropagation();
        } else {       //IE
            evt.cancelBubble = true;
        }
    }
});