简单的div弹出例子

示例

简单的div弹出例子

弹出层

<p id="spbt" onclick="spbf()" style="cursor:pointer;"">点击</p>  
<div id="MyDiv" class="white_content">
     <div style="text-align: right; cursor: default; height: 15px;">   	
        <span style="font-size: 16px;margin-right:3px" onclick="CloseDiv('MyDiv','fade')">×</span>      
     </div>
     <div style="text-align: left; cursor: default; height: 18px;">
    	<span style="font-size: 16px;margin-left:18px" >标题</span>      
     </div>			    	  						
</div> 

样式

   .white_content {
       display: none;
       position: absolute;
       top: 19%;
       left: 19%;
       width:70%;
       height:55%;
       border: 1px solid #bfc4c5;
       background-color: #f5f5f5;
       z-index: 1002;
       overflow: auto;
   }

js

	function CloseDiv(show_div, bg_div) {         
        $("#MyDiv").hide();         
    }
    function spbf(){
     	$("#MyDiv").show(); 
    }
上一篇:点击按钮让元素移动、停止


下一篇:实现DOM classList的add、remove、toggle