css浮动层lightbox效果

  css浮动层lightbox效果,点击按钮弹出悬浮的选择框怎么实现。

<!doctype html>
<style>
#lightbox{width:100%;height:100%;left:0;top:0;position:fixed;background:#000;filter:alpha(opacity=50);opacity:.5;display:none}
#layer{background:transparent;position:fixed;display:none;z-index:10;
/*注意下面2行样式,水平垂直居中用*/
left:50%;width:200px;margin-left:-100px;
top:50%;height:300px;margin-top:-150px
}
#layer input{width:100%;background:blue;color:#fff;height:50px;line-height:50px;font-size:16px;border:none;margin-top:10px}
#layer a.close{position:absolute;width:50px;height:50px;right:-100px;top:-50px;background:#f00;line-height:50px;font-size:30px;text-align:center}
</style>
<input type="button" onclick="showLayer()" value="showLayer" />
<div id="layer">
    <a class="close" onclick="showLayer(true)">X</a>
    <input type="button" value="审核1" />
    <input type="button" value="审核2" />
</div>
<div id="lightbox"></div>
<script>
    function showLayer(hide) {
        var l = document.getElementById('layer'), lb = document.getElementById('lightbox');
        l.style.display = lb.style.display =hide?'none': 'block';
    }
</script>

 

加支付宝好友偷能量挖...


原创文章,转载请注明出处:css浮动层lightbox效果

评论(0)Web开发网
阅读(268)喜欢(1)JavaScript/Ajax开发技巧