html代码
<div class="fade"></div>
<div class="inviteAlert" >....</div>
JQuery代码
$(function(){
//页面初始化时隐藏遮罩层以及弹窗
$('.fade').hide();
$(".inviteAlert").hide();
//窗口外点击事件,点击遮罩层隐藏
$(".fade").click(function () {
$(".fade").hide();
$(".inviteAlert").hide();
})
//点击头像
$(".inviteImg img").click(function(e){
//阻止事件冒泡,防止波及本按钮
e.stopPropagation();
//显示弹窗
$('.fade').show();
$(".inviteAlert").show();
//固定底部页面防止滚动
$('html').css({'overflow':'hidden','position':'fixed'})
});
//点击弹窗关闭
$(".closeAlert").click(function(e)