js控制div层的叠加简单方法

前端之家收集整理的这篇文章主要介绍了js控制div层的叠加简单方法前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

如下所示:

.black_overlay{display:none;position:absolute;top:0%;left:0%;width:100%;height:100%;
background-color:black;z-index:1001;-moz-opacity:0.8;opacity:.10;filter:alpha(opacity=80);}
.white_content{display:none;position:absolute;top:15%;left:25%;width:500px;height:250px;padding:16px;
border:1px solid #ccc;background-color:white;z-index:1002;overflow:auto;}
.white_content a{float:right; color:#aca7a7;text-decoration: none;}
.form-group{clear:both; margin:10px 0 10px 0;}
.control-label{float:left; margin:10px 0 10px 30px;color:#aca7a7;}

url,#title{width:330px;height:23px;border:solid 1px #ccc; background:#f8f8f8;color:#8d8585;}

.col-xs-9{float:left; margin:10px 0 10px 10px;}
.btn-default,.btn-primary{float:right; width:80px;border-radius: 0;color: #fff !important;
font-family: "宋体",sans-serif;font-size: 12px;line-height: 14px;
padding: 5px 18px;text-align: center;vertical-align: middle;white-space: nowrap;text-decoration: none;}
.btn-default{border:solid 1px #ccc; background:#9a9a9a;color:#fff;margin:15px 20px 0 0;}
.btn-default:hover {background:#8d8585;}
.btn-primary{border:solid 1px #ccc; background:#8bb65a;color:#fff;margin:15px 78px 0 0;}
.btn-primary:hover {background:#6c9541;}

<div class="favorite_title">
<div class="favorite_label">

PHPcms/statics/images/favorite/favorite_icon_48_48.jpg"/>

收藏

<div class="favorite_list">
<div class="list_type">
<ul class="all">

  • )
  • )
  • )
  • <div class="list_line"&gt;
    </div>
    
    <div class="list_content"&gt;
      <ul class="navigation" id="navigation"&gt;
        {loop $info $r}
        <li class="t1"&gt; 
         <a href="#" ><label class="shoucangId" id="shoucangId" style="display:none;"&gt;{$r[id]}</label>
                <h3>{$r[title]}</h3></a>
         <span class="date"&gt;{date("Y-m-d",$r[inputtime])}</span>
         <a class="edit" href="javascript:void(0)" onclick="edit_shoucang();"&gt;
         <p class="pic_center"><img alt="编辑" src="http://127.0.0.1/phpcms/statics/images/favorite/edit.jpg"/&gt;</a></p>
         <a class="delete" href="JavaScript:void(0)" onclick="ConfirmDel();"&gt;
         <p class="pic_center"><img alt="删除" src="http://127.0.0.1/phpcms/statics/images/favorite/delete.jpg"/&gt;</a></p>
         </li>
        {/loop}
        <li class="t1"&gt;
        </li>
      </ul>
    </div>

    <div id="light" class="white_content">
    <a href="javascript:void(0)" onclick="document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'">
    关闭


    <h2 style="color:#999292;">添加收藏
    <div class="form-group">
    <label for="url" class="control-label col-xs-2">*网址:
    <div class="col-xs-9">
    <input id="url" type="text" name="url" class="form-control" value=" http://"/&gt;

    <div class="form-group">
    <label for="title" class="control-label col-xs-2">*标题
    <div class="col-xs-9">

    <div class="form-group">
    <label for="title" class="control-label col-xs-2">*类别:
    <div class="col-xs-9">

    <div class="form-group">
    <div class="col-xs-5 text-right">
    <input type="submit" value="收藏" name="dosumbit" class="btn btn-primary"/>
    <button type="button" class="btn btn-default" onclick="document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'">取消

    <script type="text/javascript">
    //添加收藏
    function add_shoucang()
    {
    document.getElementById('light').style.display='block';
    document.getElementById('fade').style.display='block';
    $("#title").val('');
    $("#url").val('http://');
    $("#shoucnag_id").val('');
    $("input[name='radio'][value='钢琴谱']").attr("checked",true);
    }

    //删除
    function ConfirmDel()
    {
    var _id;
    if(confirm('确定删除?'))
    {
    $('.navigation>li').click(function(){
    var iVal = $(this).index();
    $('.navigation>li').eq(iVal).hide();
    });
    }

    else
    {
    document.getElementById('light').style.display='none';
    document.getElementById('fade').style.display='none'
    }
    }

    效果预览】

    以上就是小编为大家带来的js控制div层的叠加简单方法全部内容了,希望大家多多支持编程之家~

    js控制div叠加

    猜你在找的JavaScript相关文章