Dou*_*ith 1 html javascript css jquery sass
我想隐藏我使用 div 附加到 div 的 CSS 三角形:before,我遇到了这个解决方案来实现:https : //stackoverflow.com/a/11354393/998117
但是,我的 jQuery 不起作用:
$(".contact input[type='submit']").click(function(event) {
event.preventDefault();
$(".contact .inner").addClass("hidden");
...
Run Code Online (Sandbox Code Playgroud)
(是的,它确实被调用了。)
这是我的 CSS/SASS 的样子:
.contact {
background: #3c6ea5;
color: #fff;
display: none;
height: 500px;
.hidden:before {
display: none;
}
.inner {
margin: auto;
padding-top: 20px;
position: relative;
width: 400px;
&:before {
border: solid;
border-color: #3c6ea5 transparent;
border-width: 14px 16px 0 16px;
bottom: -107px;
content: "";
display: block;
position: absolute;
right: -50px;
}
.hidden:before {
display: none;
}
}
...
Run Code Online (Sandbox Code Playgroud)
为什么它不隐藏它?我究竟做错了什么?
你的 Sass 有点不对劲,应该是:
.inner {
&.hidden:before {
display: none;
}
}
Run Code Online (Sandbox Code Playgroud)
注意隐藏之前的 &
| 归档时间: |
|
| 查看次数: |
108 次 |
| 最近记录: |