Я пытаюсь получить заголовок, который становится меньше по прокрутке, сделанной для моего сайта. Он работает очень хорошо, но, несмотря на то, что переходы включаются в CSS, изображения в заголовке только плавно переходят, когда малый заголовок преобразуется в большой (на прокрутке вверх), а не наоборот. Сейчас это выглядит как-то странно.
Вот мой CSS для изображений:
Логотип:
.Logo.small:hover {
background: url("images/Logo.png") no-repeat;
background-size: contain;
position: absolute;
top: 8px;
width: 40px;
height: 40px;
z-index: 73;
-webkit-transition: background-image .5s;
-webkit-transition: height 0.6s;
-moz-transition: height 0.6s;
transition: height 0.6s;
-webkit-transition: width 0.6s;
-moz-transition: width 0.6s;
transition: width 0.6s;
}
.Logo:hover {
background: url("images/LogoHover.png") no-repeat;
background-size: contain;
position: absolute;
top: 8px;
width: 81px;
height: 85px;
z-index: 70;
-webkit-transition: background-image .5s;
}
.Logo {
background: url("images/Logo.png") no-repeat;
background-size: contain;
position: absolute;
top: 8px;
width: 81px;
height: 85px;
z-index: 73;
-webkit-transition: background-image .5s;
-webkit-transition: width .5s;
-webkit-transition: height .5s;
}
.Logo.small {
background: url("images/Logo.png") no-repeat;
background-size: contain;
position: absolute;
top: 8px;
width: 40px;
height: 40px;
z-index: 73;
-webkit-transition: background-image .5s;
-webkit-transition: width .5s;
-webkit-transition: height .5s;
}
Социальная икона 1:
.Icon_BG1 {
background: url("images/IconBG.png") no-repeat;
background-size: contain;
position: absolute;
margin-left: 905px;
top: 26px;
width: 45px;
height: 48px;
z-index: 80;
-webkit-transition: background-image .5s;
-webkit-transition: width .5s;
-webkit-transition: height .5s;
}
.Icon_BG1.small {
background: url("images/IconBG.png") no-repeat;
position: absolute;
margin-left: 905px;
top: 10px;
background-size: contain;
width: 35px;
height: 35px;
z-index: 80;
-webkit-transition: background-image .5s;
-webkit-transition: width .5s;
-webkit-transition: height .5s;
}
.Icon_BG1.small:hover {
background: url("images/IconBGHover.png") no-repeat;
position: absolute;
margin-left: 905px;
top: 10px;
background-size: contain;
width: 35px;
height: 35px;
z-index: 80;
-webkit-transition: background-image .5s;
}
.Icon_BG1:hover {
background: url("images/IconBGHover.png") no-repeat;
position: absolute;
margin-left:905px;
top: 26px;
width: 45px;
height: 48px;
z-index: 80;
-webkit-transition: background-image .5s;
}
Социальная икона 2:
.Icon_BG_2 {
background: url("images/IconBG2.png") no-repeat;
background-size: contain;
position: absolute;
margin-left: 960px;
top: 26px;
width: 45px;
height: 48px;
z-index: 82;
-webkit-transition: background-image .5s;
-webkit-transition: width .5s;
-webkit-transition: height .5s;
}
.Icon_BG_2.small {
background: url("images/IconBG2.png") no-repeat;
background-size: contain;
position: absolute;
margin-left: 960px;
top: 10px;
width: 35px;
height: 35px;
z-index: 82;
-webkit-transition: background-image .5s;
-webkit-transition: width .5s;
-webkit-transition: height .5s;
}
.Icon_BG_2.small:hover {
background: url("images/IconBGHover2.png") no-repeat;
background-size: contain;
position: absolute;
margin-left: 960px;
top: 10px;
width: 35px;
height: 35px;
z-index: 82;
-webkit-transition: background-image .5s;
}
.Icon_BG_2:hover {
background: url("images/IconBGHover2.png") no-repeat;
position: absolute;
margin-left:960x;
top: 26px;
width: 45px;
height: 48px;
z-index: 82;
-webkit-transition: background-image .5s;
}
потому что вы используете background-size
для изменения размера изображений, а не для transform
использование
transform: scale(xx);
для изменения размера