![](/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.