简体   繁体   English

如何让文字滑入滑出页面

[英]How to make text slide in and out of the page

I need to achieve same effect as slide in and out effect like on this page: https://pangrampangram.com/products/neue-machina我需要实现与此页面上的滑入和滑出效果相同的效果: https://pangrampangram.com/products/neue-machina

create a div inside a another div make the child div bigger than parent div once it get done you can make the child scrolling by left or right attribute in css.在另一个 div 中创建一个 div 使子 div 大于父 div 一旦完成,您可以使子 div 在 css 中按左或右属性滚动。

`<html data-test-id="brave-new-tab-page" dir="ltr">
.parent { width: 500px; .parent { 宽度:500px; height: 100px; 高度:100px; overflow: hidden; 溢出:隐藏; position: absolute; position:绝对; }.child { width: 1347px; }.child { 宽度:1347px; font-size: 76px; 字体大小:76px; position: absolute; position:绝对; } test test test test test test test tesenter code heret test test let position = 0; } 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 + 'px') 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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM