当我单击“打开”按钮时,它会淡出,但“ navigazione” div不会消失。在“ navigazione ID”上,我可以看到脚本正在工作。显然,我需要“ navigazione id”以无显示开头。问题出在哪里?预先感谢您的帮助!
JS
<script>
$(document).ready(function(e) {
$("#close-icon").on('click', function() {
$("#menu-butt").fadeIn();
$("#navigazione").fadeOut();
});
$("#menu-butt").on('click', function() {
$("#menu-butt").fadeOut();
$("#navigazione").fadeIn();
});
});
</script>
的HTML
<div id="navigazione"> <div> <div id="button"> ciao </div> </div>
<div class="row menu-butt"><a href="#" id="menu-butt">open<a></div>
<div id="close-icon"><a href="#" id="close-icon">close<a></div>
的CSS
#navigazione { height: 100vh;
width:100%;
position: fixed ;
top: 0px;
left: 0px;
background-color: rgba(28,82,23,0.95);
z-index:400;
display: none;
}
#close-icon{ position: fixed;
height: cover;
top: 20px;
right: 30px !important;
z-index: 450 ;
display: none;
}
最佳答案
这是您要寻找的-
$(document).ready(function(e) {
$("#close-icon").on('click', function() {
$("#menu-butt").fadeIn();
$("#navigazione").fadeOut();
});
$("#menu-butt").on('click', function() {
$("#menu-butt").fadeOut();
$("#navigazione").fadeIn();
});
});
#navigazione { height: 100vh;
width:100%;
position: fixed ;
top: 0px;
left: 0px;
background-color: rgba(28,82,23,0.95);
z-index:400;
display: none;
}
#close-icon{ position: fixed;
height: cover;
top: 20px;
right: 30px !important;
z-index: 450 ;
}
close-icon {
color:#000;
}
.menu-butt {
color:#000;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="navigazione"> <div id="button"> ciao </div> </div>
<div class="row menu-butt"><a href="#" id="menu-butt">open</a></div>
<div id="close-icon"><a href="#" id="close-icon">close</a></div>
关于javascript - 淡化点击无效,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/34447496/