页面添加 mask 遮罩层

var mask = function(){
$('<div>').css({
  position: 'fixed',
  left: 0,
  top: 0,
   '100%',
  height: '100%',
  zIndex: '90',
  backgroundColor: 'rgb(0, 0, 0)',
  opacity: 0.5
}).appendTo('body').attr('id', '_jsPop');
$('#_jsPop').click(function(){
  $(this).remove();
});
};

在线DEMO: http://output.jsbin.com/biyibukuvo

原文地址:https://www.cnblogs.com/zlog/p/5387864.html