У меня проблема с эффектом перехода кнопки. Внутренняя кнопка должна скользить вправо при наведении. Моя ссылка на этот сайт: https://www.grand-forest.gr/. Но все же, я не мог сделать это. Кто-нибудь знает, как это исправить?
Вот мои коды: https://codepen.io/christine-tine27/pen/XWjpowJ
.wrapper {
padding: 0 40px;
}
.button-inner {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
}
.button-diamond {
position: relative;
/* overflow: hidden; */
width: 3.5vw;
height: 3.5vw;
margin: 0.9vw 0.9vw 0.9vw 0.6vw;
-webkit-box-flex: 0;
-webkit-flex: 0 0 auto;
-ms-flex: 0 0 auto;
flex: 0 0 auto;
border: 1px solid #383838;
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
-webkit-transition: border-color 500ms cubic-bezier(.785, .135, .15, .86);
transition: border-color 500ms cubic-bezier(.785, .135, .15, .86);
}
.button-diamond:hover > .button-diamond-hovered {
display: block;
transition: 2s;
-webkit-transform: translate(0%, 0%);
-ms-transform: translate(0%, 0%);
transform: translate(0%, 0%);
}
.button-diamond-arrow-container {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
width: 100%;
height: 100%;
-webkit-box-pack: center;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-box-align: center;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
-webkit-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
transform: rotate(-45deg);
}
.button-diamond-inner {
position: absolute;
left: 0%;
top: 0%;
right: auto;
bottom: auto;
width: 100%;
height: 100%;
z-index: 123;
}
.button-diamond-hovered {
position: absolute;
/* display: none; */
left: 0%;
top: 0%;
right: auto;
bottom: auto;
width: 100%;
height: 100%;
background-color: #c8a96a;
-webkit-transform: translate(-100%, 100%);
-ms-transform: translate(-100%, 100%);
transform: translate(-100%, 100%);
}
/* .button-diamond > .button-diamond-hovered {
display: none;
transition: 1s;
-webkit-transform: translate(0%, 0%);
-ms-transform: translate(0%, 0%);
transform: translate(0%, 0%);
} */
.arrow-line {
position: relative;
width: 40%;
height: 1px;
background-color: #383838;
}
.arrow-head {
position: absolute;
left: auto;
top: 0%;
right: 0%;
bottom: auto;
width: 8px;
height: 8px;
margin-right: -1px;
border-top: 1px solid #383838;
border-right: 1px solid #383838;
-webkit-transform: translate(0px, 5%) rotate(45deg);
-ms-transform: translate(0px, 5%) rotate(45deg);
transform: translate(0px, 5%) rotate(45deg);
-webkit-transform-origin: 100% 0%;
-ms-transform-origin: 100% 0%;
transform-origin: 100% 0%;
}
.arrow-line.arrow-line-white {
background-color: #faf7f1;
}
.arrow-head.arrow-head-white {
border-top-color: #faf7f1;
border-right-color: #faf7f1;
}
.button-text {
display: inline-block;
margin-left: 10px;
-webkit-box-flex: 0;
-webkit-flex: 0 0 auto;
-ms-flex: 0 0 auto;
flex: 0 0 auto;
-webkit-transition: color 500ms cubic-bezier(.785, .135, .15, .86);
transition: color 500ms cubic-bezier(.785, .135, .15, .86);
font-size: 1.5vw;
line-height: 2.2vw;
}
.home .button {
display: inline-block !important;
width: auto !important;
-webkit-box-pack: start !important;
-webkit-justify-content: flex-start !important;
-ms-flex-pack: start !important;
justify-content: flex-start !important;
-webkit-box-align: center !important;
-webkit-align-items: center !important;
-ms-flex-align: center !important;
align-items: center !important;
grid-auto-columns: 1fr !important;
grid-column-gap: 16px !important;
grid-row-gap: 16px !important;
-ms-grid-columns: 1fr 1fr !important;
grid-template-columns: 1fr 1fr !important;
-ms-grid-rows: auto auto !important;
grid-template-rows: auto auto !important;
color: #383838 !important;
text-decoration: none !important;
}
.home .button:hover {
color: #000;
}
.button.slide-in.w-inline-block:hover {
opacity: 1; transform: translate3d(0px, 0px, 0px) scale3d(1, 1, 1) rotateX(0deg) rotateY(0deg) rotateZ(0deg) skew(0deg, 0deg); transform-style: preserve-3d;
}
.button-diamond-inner:hover {
transform: translate3d(0%, 0%, 0px) scale3d(1, 1, 1) rotateX(0deg) rotateY(0deg) rotateZ(0deg) skew(0deg, 0deg); transform-style: preserve-3d;
}
.button-diamond-hovered:hover {
transform: translate3d(-100%, 100%, 0px) scale3d(1, 1, 1) rotateX(0deg) rotateY(0deg) rotateZ(0deg) skew(0deg, 0deg); transform-style: preserve-3d;
}
<div class = "wrapper">
<a href = "#" class = "button slide-in w-inline-block">
<div class = "button-inner">
<div class = "button-diamond">
<div class = "button-diamond-inner">
<div class = "button-diamond-arrow-container">
<div class = "arrow-line">
<div class = "arrow-head"></div>
</div>
</div>
</div>
<div class = "button-diamond-hovered">
<div class = "button-diamond-arrow-container">
<div class = "arrow-line arrow-line-white">
<div class = "arrow-head arrow-head-white"></div>
</div>
</div>
</div>
</div>
</div>
</a>
</div>
Ваша проблема просто скрывает переполнение
.wrapper {
padding: 0 40px;
}
.button-inner {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
}
.button-diamond {
position: relative;
/* overflow: hidden; */
width: 3.5vw;
height: 3.5vw;
margin: 0.9vw 0.9vw 0.9vw 0.6vw;
-webkit-box-flex: 0;
-webkit-flex: 0 0 auto;
-ms-flex: 0 0 auto;
flex: 0 0 auto;
border: 1px solid #383838;
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
overflow: hidden;
transform: rotate(45deg);
-webkit-transition: border-color 500ms cubic-bezier(.785, .135, .15, .86);
transition: border-color 500ms cubic-bezier(.785, .135, .15, .86);
}
.button-diamond:hover > .button-diamond-hovered {
display: block;
transition: 2s;
-webkit-transform: translate(0%, 0%);
-ms-transform: translate(0%, 0%);
transform: translate(0%, 0%);
}
.button-diamond-arrow-container {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
width: 100%;
height: 100%;
-webkit-box-pack: center;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-box-align: center;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
-webkit-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
transform: rotate(-45deg);
}
.button-diamond-inner {
position: absolute;
left: 0%;
top: 0%;
right: auto;
bottom: auto;
width: 100%;
height: 100%;
z-index: 123;
}
.button-diamond-hovered {
position: absolute;
/* display: none; */
left: 0%;
top: 0%;
right: auto;
bottom: auto;
width: 100%;
height: 100%;
background-color: #c8a96a;
-webkit-transform: translate(-100%, 100%);
-ms-transform: translate(-100%, 100%);
transform: translate(-100%, 100%);
}
/* .button-diamond > .button-diamond-hovered {
display: none;
transition: 1s;
-webkit-transform: translate(0%, 0%);
-ms-transform: translate(0%, 0%);
transform: translate(0%, 0%);
} */
.arrow-line {
position: relative;
width: 40%;
height: 1px;
background-color: #383838;
}
.arrow-head {
position: absolute;
left: auto;
top: 0%;
right: 0%;
bottom: auto;
width: 8px;
height: 8px;
margin-right: -1px;
border-top: 1px solid #383838;
border-right: 1px solid #383838;
-webkit-transform: translate(0px, 5%) rotate(45deg);
-ms-transform: translate(0px, 5%) rotate(45deg);
transform: translate(0px, 5%) rotate(45deg);
-webkit-transform-origin: 100% 0%;
-ms-transform-origin: 100% 0%;
transform-origin: 100% 0%;
}
.arrow-line.arrow-line-white {
background-color: #faf7f1;
}
.arrow-head.arrow-head-white {
border-top-color: #faf7f1;
border-right-color: #faf7f1;
}
.button-text {
display: inline-block;
margin-left: 10px;
-webkit-box-flex: 0;
-webkit-flex: 0 0 auto;
-ms-flex: 0 0 auto;
flex: 0 0 auto;
-webkit-transition: color 500ms cubic-bezier(.785, .135, .15, .86);
transition: color 500ms cubic-bezier(.785, .135, .15, .86);
font-size: 1.5vw;
line-height: 2.2vw;
}
.home .button {
display: inline-block !important;
width: auto !important;
-webkit-box-pack: start !important;
-webkit-justify-content: flex-start !important;
-ms-flex-pack: start !important;
justify-content: flex-start !important;
-webkit-box-align: center !important;
-webkit-align-items: center !important;
-ms-flex-align: center !important;
align-items: center !important;
grid-auto-columns: 1fr !important;
grid-column-gap: 16px !important;
grid-row-gap: 16px !important;
-ms-grid-columns: 1fr 1fr !important;
grid-template-columns: 1fr 1fr !important;
-ms-grid-rows: auto auto !important;
grid-template-rows: auto auto !important;
color: #383838 !important;
text-decoration: none !important;
}
.home .button:hover {
color: #000;
}
.button.slide-in.w-inline-block:hover {
opacity: 1; transform: translate3d(0px, 0px, 0px) scale3d(1, 1, 1) rotateX(0deg) rotateY(0deg) rotateZ(0deg) skew(0deg, 0deg); transform-style: preserve-3d;
}
.button-diamond-inner:hover {
transform: translate3d(0%, 0%, 0px) scale3d(1, 1, 1) rotateX(0deg) rotateY(0deg) rotateZ(0deg) skew(0deg, 0deg); transform-style: preserve-3d;
}
.button-diamond-hovered:hover {
transform: translate3d(-100%, 100%, 0px) scale3d(1, 1, 1) rotateX(0deg) rotateY(0deg) rotateZ(0deg) skew(0deg, 0deg); transform-style: preserve-3d;
}
<div class = "wrapper">
<a href = "#" class = "button slide-in w-inline-block">
<div class = "button-inner">
<div class = "button-diamond">
<div class = "button-diamond-inner">
<div class = "button-diamond-arrow-container">
<div class = "arrow-line">
<div class = "arrow-head"></div>
</div>
</div>
</div>
<div class = "button-diamond-hovered">
<div class = "button-diamond-arrow-container">
<div class = "arrow-line arrow-line-white">
<div class = "arrow-head arrow-head-white"></div>
</div>
</div>
</div>
</div>
</div>
</a>
</div>
@ChristineSalazar, вы можете отметить это как решение, если оно сработало.