fix: 系统名称横向滚动衔接动画

This commit is contained in:
TsMask
2024-07-16 11:21:16 +08:00
parent 79920542c1
commit a2d93ddafe
3 changed files with 54 additions and 29 deletions

View File

@@ -176,6 +176,7 @@ function fnCheckAppNameOverflow() {
if (!text) return;
if (text.offsetWidth > container.offsetWidth) {
text.classList.add('app-name_scrollable');
text.setAttribute('data-content', text.innerText);
} else {
text.classList.remove('app-name_scrollable');
}
@@ -382,20 +383,26 @@ onUnmounted(() => {
// text-overflow: ellipsis;
white-space: nowrap;
width: 148px;
&_scrollable {
// padding-left: 100%;
> .app-name_scrollable {
padding-right: 12px;
display: inline-block;
animation: scrollable-animation linear 6s infinite both;
}
@keyframes scrollable-animation {
0% {
transform: translate3d(0, 0, 0);
&::after {
content: attr(data-content);
position: absolute;
top: 0;
right: -100%;
transition: right 0.3s ease;
}
100% {
transform: translate3d(-100%, 0, 0);
@keyframes scrollable-animation {
0% {
transform: translateX(0);
}
100% {
transform: translateX(calc(-100% - 12px));
}
}
}
}