Я хочу скрыть свой CSS-треугольник, который прикреплен к div, используя :before
, и я наткнулся на это решение для реализации: qaru.site/questions/347867/...
Однако мой jQuery не работает:
$(".contact input[type='submit']").click(function(event) {
event.preventDefault();
$(".contact .inner").addClass("hidden");
...
(Да, он вызван.)
Вот как выглядит мой 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;
}
}
...
Почему это не скрывает это? Что я делаю не так?
Ваш Sass отключен немного, должно быть:
.inner {
&.hidden:before {
display: none;
}
}
Обратите внимание на & before hidden