昨天我为朋友做了这个。这可能会帮助你。
演示
HTML:
<div id="fblightbox">
<div class="fblightbox-wrap">
<div class="fblightbox-header">
<h3>This header is just awesome xD</h3>
</div>
<div class="fblightbox-content">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
</div>
<div class="fblightbox-footer">
<a href="#" class="fbbutton">Continue</a>
<a href="#" id="close" class="fbbutton">Close</a>
</div>
</div>
</div>
<div class="overlay"></div>
<div class="demo">
<a id="launch" class="fbbutton" href="#">Launch Popup</a>
</div>
CSS:
*{
margin:0;
padding:0;
}
#fblightbox{
background: rgba(82, 82, 82, .7);
color: #333;
font-family: 'lucida grande', tahoma, verdana, arial, sans-serif;
border-radius: 8px;
padding:10px;
width: 575px;
position: fixed;
left:50%;
top:50%;
z-index: 99999;
display:none;
}
.fblightbox-wrap{
border: 1px solid #3B5998;
}
.fblightbox-header{
background:#6C83B8;
border-bottom: 1px solid #29447E;
color: #fff;
font-size: 14px;
padding:5px;
}
.fblightbox-header h3{
font-size:14px;
}
.fblightbox-content{
background:#fff;
font-size: 12px;
padding:10px;
}
.fblightbox-footer{
background: #f2f2f2;
border-top: 1px solid #ccc;
color: #333;
padding: 10px;
text-align:right;
}
.fbbutton{
text-decoration:none;
color:#fff;
font-family: 'lucida grande', tahoma, verdana, arial, sans-serif;
font-size: 13px;
border-style: solid;
background-image: url(http://i.imgur.com/tu8qPWG.png);
cursor: pointer;
font-weight: bold;
padding: 4px 8px 4px 8px;
text-align: center;
vertical-align: top;
white-space: nowrap;
border-width: 1px;
margin-left: 3px;
background-position: 125px 235px;
border-color: #29447E #29447E #1A356E;
line-height: normal !important;
display: inline-block;
}
.overlay{
background: rgba(0,0,0,0.2);
position:fixed;
width:100%;
height: 100%;
z-index: 99;
display:none;
}
.demo{
padding:30px 50px;
}
JS:
var fblightbox = $('#fblightbox');
fblightbox.css({'margin-left':'-'+(fblightbox.width()/2)+'px','margin-top':'-'+(fblightbox.height()/2)+'px'});
$("#launch").click(function() {
$('.overlay').fadeIn();
fblightbox.fadeIn();
});
$("#close").click(function() {
$('.overlay').fadeOut();
fblightbox.fadeOut();
});