![](/img/trans.png)
[英]How to make text slide from the left (hidden to visible), then stop in the middle and then slide all the way to right and out of the page and repeat?
[英]How to make text slide in and out of the page
在另一个 div 中创建一个 div 使子 div 大于父 div 一旦完成,您可以使子 div 在 css 中按左或右属性滚动。
`<html data-test-id="brave-new-tab-page" dir="ltr">
.parent { 宽度:500px;
高度:100px;
溢出:隐藏;
position:绝对;
}.child { 宽度:1347px;
字体大小:76px;
position:绝对;
} test test test test test test tesenter code heret test test let position = 0;
document.addEventListener('DOMContentLoaded', () => { setInterval(() => { let child = document.getElementsByClassName('child')[0] child.setAttribute('style', 'left:-' + position + '像素')
if ( position > ( 1347 - 500 ) ) position = 0 position ++ }, 5) }, false); </script>
`
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.