|
发表于 2024-10-28 16:25:42
|
显示全部楼层
IP:
本帖最后由 丁香 于 2024-11-17 07:41 编辑
欣赏丁香版的全屏移动美图,精彩,向您学习!下午好!
- <style>
- #oBlk {
- margin-left: 50% ; left: -598px;
- margin-top:110px;
- width: 1210px;
- height: 640px;
- box-shadow: 3px 3px 10px #000;
- overflow: hidden;
- position: absolute;
- }
- #oBlk::before,
- #oBlk::after {
- position: absolute;
- content: '';
- left: var(--curX0);
- top: 0px;
- width: 100%;
- height: 100%;
- background: url('https://file.uhsea.com/2411/ae7869c26370a099aa4a1a00a170cefdXX.jpg') no-repeat center / cover;
- }
- #oBlk::after {
- left: var(--curX1);
- transform: scaleX(-1);
- }
- </style>
- <div id="oBlk"></div>
- <div style="height:640px;"></div>
- <script>
- {
- let blkWidth = oBlk.offsetWidth;
- let step = 1.0, tune = 0,
- curX0 = 0,
- curX1 = blkWidth,
- raf;
- let moving = () => {
- /*
- //自左向右
- curX0 += step;
- curX1 += step;
- if(curX0 >= blkWidth) curX0 = -blkWidth;
- if(curX1 >= blkWidth) curX1 = -blkWidth;
- */
- //自右向左
- curX0 -= step;
- curX1 -= step;
- if(curX0 <= -blkWidth) curX0 = blkWidth;
- if(curX1 <= -blkWidth) curX1 = blkWidth;
- tune = curX1 + (curX0 >= 0 ? 1 : -1);
- oBlk.style.setProperty('--curX0', curX0 + 'px');
- oBlk.style.setProperty('--curX1', tune + 'px');
- raf = requestAnimationFrame(moving);
- };
- moving();
- }
- </script></div></div><br><br><br><br><br><video autoplay="" controls="" height="1"
- src="https://link.hhtjim.com/163/1406642934.mp3" width="2">
复制代码 移动图片加音乐
|
|