https://www.jq22.com/webqd5955
- html
<div>这是一个主界面</div><br>
<button id="btn">点击这里实现弹窗</button>
<div id="choiceWindow">
<label id="x" style="position: absolute;top:2px;left: 95%;font-size: 25px;">x</label>
<form>
<label>请选择开课学期:</label>
<select>
<option value="2017-2018-1">2017-2018-1</option>
<option value="2017-2018-2">2017-2018-2</option>
</select><br><br>
</form>
</div>
<div id="backGround"></div>
- CSS
#choiceWindow {
display:none;
position:absolute;
top:25%;
left:25%;
width:30%;
height:55%;
padding:20px;
border:3px solid #ccc;
background-color:white;
z-index:2;
overflow:auto;
}
#backGround {
display:none;
position:absolute;
top:0%;
left:0%;
width:100%;
height:1100px;
background-color:black;
z-index:1;
-moz-opacity:0.8;
opacity:.80;
filter:alpha(opacity=88);
}
#x:hover {
cursor:pointer;
color:rgb(55,198,192);
}
- JS
$(document).ready(function() {
$("#btn").click(function() {
$("#choiceWindow").slideDown(300);
$("#backGround").show();
});
$("#x").click(function() {
$("#choiceWindow").slideUp(300);
$("#backGround").hide();
})
});