<div class="cookie">
<div class="cookie__title">Мы используем файлы <a href="#">cookie</a></div>
<div class="cookie__text">
<p>для того, чтобы предоставить вам больше возможностей при использовании сайта</p>
</div>
<div class="cookie__button">
<a href="javascript://">Хорошо</a>
</div>
</div>
.cookie {
position: fixed;
bottom: 0;
right: 0;
background-color: #f9f8f8;
padding: 24px;
width: 296px;
z-index: 1000;
}
.cookie > *:first-child {
margin-top: 0 !important;
}
.cookie > *:nth-last-child(-n + 1) {
margin-bottom: 0 !important;
}
.cookie__title {
font-size: 24px;
font-weight: 400;
line-height: 28px;
margin: 8px 0;
}
.cookie__title a {
color: #4ebe99;
border-bottom: 1px solid #4ebe99;
transition: border-color .3s;
}
.cookie__title a:hover {
border-color: transparent;
}
.cookie__text {
font-size: 16px;
font-weight: 300;
line-height: 20px;
margin: 8px 0;
}
.cookie__text p {
margin: 0;
}
.cookie__button {
margin: 24px 0;
}
.cookie__button a {
display: inline-flex;
border-radius: 100px;
background-color: #4ebe99;
font-size: 14px;
font-weight: 400;
line-height: 24px;
color: #fff;
padding: 7px 28px;
transition: background-color .3s;
}
.cookie__button a:hover {
background-color: #83d2b8;
}
@media only screen and (max-width: 639px) {
.cookie {
border-radius: 16px 16px 0 0;
padding: 16px;
width: 100%;
}
.cookie__title {
font-size: 18px;
font-weight: 300;
line-height: 24px;
}
.cookie__text {
font-size: 12px;
font-weight: 300;
line-height: 14px;
}
.cookie__button {
margin: 12px 0;
}
}
@import "../helpers/helpers";
.cookie {
position: fixed;
bottom: 0;
right: 0;
background-color: #f9f8f8;
padding: 24px;
width: 296px;
z-index: 1000;
@include resetMarginTop();
@include resetMarginBottom();
@include max-screen(639px) {
border-radius: 16px 16px 0 0;
padding: 16px;
width: 100%;
}
}
.cookie__title {
font-size: 24px;
font-weight: 400;
line-height: 28px;
margin: 8px 0;
@include max-screen(639px) {
font-size: 18px;
font-weight: 300;
line-height: 24px;
}
a {
color: #4ebe99;
border-bottom: 1px solid #4ebe99;
transition: border-color .3s;
&:hover {
border-color: transparent;
}
}
}
.cookie__text {
font-size: 16px;
font-weight: 300;
line-height: 20px;
margin: 8px 0;
@include max-screen(639px) {
font-size: 12px;
font-weight: 300;
line-height: 14px;
}
p {
margin: 0;
}
}
.cookie__button {
margin: 24px 0;
@include max-screen(639px) {
margin: 12px 0;
}
a {
display: inline-flex;
border-radius: 100px;
background-color: #4ebe99;
font-size: 14px;
font-weight: 400;
line-height: 24px;
color: #fff;
padding: 7px 28px;
transition: background-color .3s;
&:hover {
background-color: #83d2b8;
}
}
}
const cookie = document.querySelector('.cookie');
if (document.querySelector('.cookie')) {
if (document.cookie.indexOf("warning") != -1) {
cookie.remove();
}
const apply = cookie.querySelector(".cookie__button");
apply.addEventListener("click", () => {
cookie.remove();
document.cookie = "warning=true; max-age=2592000; path=/";
});
}