为什么无效?哪里错了
<style>
html, body {
height: 100%;
margin: 0;
padding: 0;
}
.test{
position: fixed;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
opacity: 0;
visibility: hidden;
}
.test.is-visible {
opacity: 1;
visibility: visible;
-webkit-transition: opacity 0.3s 0s, visibility 0s 0s;
-moz-transition: opacity 0.3s 0s, visibility 0s 0s;
transition: opacity 0.3s 0s, visibility 0s 0s;
}
</style>
<div class="test is-visible"> </div>
<script>
//点击任意地方隐藏窗口
$('.test').on('click', function(event){
if( $(event.target).is('.test') ) {
$(this).removeClass('is-visible');
}
});
</script>
相关分类