马黑黑 发表于 2024-4-7 16:48

单图背景水平方向无缝循环滚动模板(两种实现机制)

本帖最后由 马黑黑 于 2024-4-7 17:50 编辑 <br /><br /><style>
.mum { position: relative; margin: 0; padding: 10px; font: normal 16px/20px Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; color: black; background: rgba(240, 240, 240,.95); box-shadow: 2px 2px 4px gray; border: thick groove lightblue; border-radius: 6px; }
.mum ::selection { background-color: rgba(0,100,100,.35); }
.mum div { margin: 0; padding: 0; }
.mum cl-cd { display: block; position: relative; margin: 0 0 0 50px; padding: 0 0 0 10px; white-space: pre-wrap; overflow-wrap: break-word; border-left: 1px solid silver; }
.mum cl-cd::before { position: absolute; content: attr(data-idx); width: 50px; color: gray; text-align: right; transform: translate(-70px); }
.tRed { color: red; }
.tBlue { color: blue; }
.tGreen { color: green; }
.tDarkRed { color: darkred; }
.tMagenta { color: magenta; }
</style>

<p>以下两组代码为实例代码,都通过帖子元素的两个伪元素加以实现。音频联动控制中,包含了一个视频的同步控制。</p>
<h2>一、移动伪元素的实现机制</h2>
<p>这个机制有灵活性,帖子元素的宽高可以不管背景图片的实际尺寸。<br><br></p>
<div class='mum'>
<cl-cd data-idx="1">&lt;<span class="tDarkRed">style</span>&gt;</cl-cd>
<cl-cd data-idx="2">#mydiv {</cl-cd>
<cl-cd data-idx="3">&nbsp; &nbsp; <span class="tBlue">margin:</span> 20px auto;</cl-cd>
<cl-cd data-idx="4">&nbsp; &nbsp; <span class="tBlue">width:</span> 960px;</cl-cd>
<cl-cd data-idx="5">&nbsp; &nbsp; <span class="tBlue">height:</span> 540px;</cl-cd>
<cl-cd data-idx="6">&nbsp; &nbsp; <span class="tBlue">background:</span> lightgreen url(<span class="tMagenta">'https://638183.freep.cn/638183/t24/1/levels.jpg'</span>) no-repeat center/cover;</cl-cd>
<cl-cd data-idx="7">&nbsp; &nbsp; <span class="tBlue">box-shadow:</span> 4px 4px 8px gray;</cl-cd>
<cl-cd data-idx="8">&nbsp; &nbsp; <span class="tBlue">box-sizing:</span> border-box;</cl-cd>
<cl-cd data-idx="9">&nbsp; &nbsp; <span class="tBlue">overflow:</span> hidden;</cl-cd>
<cl-cd data-idx="10">&nbsp; &nbsp; <span class="tBlue">z-index:</span> 1;</cl-cd>
<cl-cd data-idx="11">&nbsp; &nbsp; <span class="tBlue">position:</span> relative;</cl-cd>
<cl-cd data-idx="12">}</cl-cd>
<cl-cd data-idx="13">#mydiv::before , #mydiv::after {</cl-cd>
<cl-cd data-idx="14">&nbsp; &nbsp; <span class="tBlue">position:</span> absolute;</cl-cd>
<cl-cd data-idx="15">&nbsp; &nbsp; <span class="tBlue">content:</span> <span class="tMagenta">''</span>;</cl-cd>
<cl-cd data-idx="16">&nbsp; &nbsp; <span class="tBlue">left:</span> <span class="tBlue">var</span>(--begin1);</cl-cd>
<cl-cd data-idx="17">&nbsp; &nbsp; <span class="tBlue">top:</span> 0px;</cl-cd>
<cl-cd data-idx="18">&nbsp; &nbsp; <span class="tBlue">width:</span> 100%;</cl-cd>
<cl-cd data-idx="19">&nbsp; &nbsp; <span class="tBlue">height:</span> 100%;</cl-cd>
<cl-cd data-idx="20">&nbsp; &nbsp; <span class="tBlue">background:</span> url(<span class="tMagenta">'https://638183.freep.cn/638183/t24/1/levels.jpg'</span>) no-repeat center/cover;</cl-cd>
<cl-cd data-idx="21">&nbsp; &nbsp; <span class="tBlue">z-index:</span> -1;</cl-cd>
<cl-cd data-idx="22">}</cl-cd>
<cl-cd data-idx="23">&nbsp;</cl-cd>
<cl-cd data-idx="24">#mydiv::after {</cl-cd>
<cl-cd data-idx="25">&nbsp; &nbsp; <span class="tBlue">left:</span> <span class="tBlue">var</span>(--begin2);</cl-cd>
<cl-cd data-idx="26">&nbsp; &nbsp; <span class="tBlue">transform:</span> scale(-1,1);</cl-cd>
<cl-cd data-idx="27">}</cl-cd>
<cl-cd data-idx="28">#play {</cl-cd>
<cl-cd data-idx="29">&nbsp; &nbsp; <span class="tBlue">position:</span> absolute;</cl-cd>
<cl-cd data-idx="30">&nbsp; &nbsp; <span class="tBlue">left:</span> calc(50% - 50px);</cl-cd>
<cl-cd data-idx="31">&nbsp; &nbsp; <span class="tBlue">bottom:</span> 10px;</cl-cd>
<cl-cd data-idx="32">&nbsp; &nbsp; <span class="tBlue">width:</span> 100px;</cl-cd>
<cl-cd data-idx="33">&nbsp; &nbsp; <span class="tBlue">cursor:</span> pointer;</cl-cd>
<cl-cd data-idx="34">&nbsp; &nbsp; <span class="tBlue">animation:</span> rotating 5s linear infinite <span class="tBlue">var</span>(--state);</cl-cd>
<cl-cd data-idx="35">}</cl-cd>
<cl-cd data-idx="36">#vid {</cl-cd>
<cl-cd data-idx="37">&nbsp; &nbsp; <span class="tBlue">position:</span> absolute;</cl-cd>
<cl-cd data-idx="38">&nbsp; &nbsp; <span class="tBlue">right:</span> 0;</cl-cd>
<cl-cd data-idx="39">&nbsp; &nbsp; <span class="tBlue">width:</span> 40%;</cl-cd>
<cl-cd data-idx="40">&nbsp; &nbsp; <span class="tBlue">height:</span> 30%;</cl-cd>
<cl-cd data-idx="41">&nbsp; &nbsp; <span class="tBlue">object-fit:</span> cover;</cl-cd>
<cl-cd data-idx="42">&nbsp; &nbsp; <span class="tBlue">mix-blend-mode:</span> screen;</cl-cd>
<cl-cd data-idx="43">&nbsp; &nbsp; <span class="tBlue">transform:</span> rotate(-15deg);</cl-cd>
<cl-cd data-idx="44">&nbsp; &nbsp; <span class="tBlue">pointer-events:</span> none;</cl-cd>
<cl-cd data-idx="45">}</cl-cd>
<cl-cd data-idx="46">@keyframes rotating { to { <span class="tBlue">transform:</span> rotate(360deg); } }</cl-cd>
<cl-cd data-idx="47">&lt;<span class="tDarkRed">/style</span>&gt;</cl-cd>
<cl-cd data-idx="48">&nbsp;</cl-cd>
<cl-cd data-idx="49">&lt;<span class="tDarkRed">div</span> <span class="tRed">id</span>=<span class="tMagenta">"mydiv"</span>&gt;</cl-cd>
<cl-cd data-idx="50">&nbsp; &nbsp; &lt;<span class="tDarkRed">audio</span> <span class="tRed">id</span>=<span class="tMagenta">"aud"</span> src=<span class="tMagenta">"https://music.163.com/song/media/outer/url?<span class="tRed">id</span>=2130363396"</span> autoplay&gt;&lt;<span class="tDarkRed">/audio</span>&gt;</cl-cd>
<cl-cd data-idx="51">&nbsp; &nbsp; &lt;<span class="tDarkRed">video</span> <span class="tRed">id</span>=<span class="tMagenta">"vid"</span> src=<span class="tMagenta">"https://img.tukuppt.com/video_show/7165162/00/19/81/5f154503b457d.mp4"</span> muted loop&gt;&lt;<span class="tDarkRed">/video</span>&gt;</cl-cd>
<cl-cd data-idx="52">&nbsp; &nbsp; &lt;<span class="tDarkRed">img</span> <span class="tRed">id</span>=<span class="tMagenta">"play"</span> src=<span class="tMagenta">"https://638183.freep.cn/638183/web/svg/clover4.svg"</span> alt=<span class="tMagenta">""</span> /&gt;</cl-cd>
<cl-cd data-idx="53">&lt;<span class="tDarkRed">/div</span>&gt;</cl-cd>
<cl-cd data-idx="54">&nbsp;</cl-cd>
<cl-cd data-idx="55">&lt;<span class="tDarkRed">script</span>&gt;</cl-cd>
<cl-cd data-idx="56">&nbsp;</cl-cd>
<cl-cd data-idx="57"><span class="tBlue">var</span> ww = mydiv.offsetWidth;</cl-cd>
<cl-cd data-idx="58">&nbsp;</cl-cd>
<cl-cd data-idx="59"><span class="tBlue">var</span> step = 1, begin1 = 0, begin2 = ww, raf;</cl-cd>
<cl-cd data-idx="60">&nbsp;</cl-cd>
<cl-cd data-idx="61">aud.loop = false;</cl-cd>
<cl-cd data-idx="62">aud.onpause = aud.onplaying = () =&gt;moving();</cl-cd>
<cl-cd data-idx="63">aud.onseeked = () =&gt; cancelAnimationFrame(raf);</cl-cd>
<cl-cd data-idx="64">aud.onended = () =&gt; { cancelAnimationFrame(raf); aud.play(); };</cl-cd>
<cl-cd data-idx="65">&nbsp;</cl-cd>
<cl-cd data-idx="66">play.onclick = () =&gt; { aud.paused ? aud.play() : aud.pause(); };</cl-cd>
<cl-cd data-idx="67">&nbsp;</cl-cd>
<cl-cd data-idx="68"><span class="tBlue">var</span> moving = () =&gt; {</cl-cd>
<cl-cd data-idx="69">&nbsp; &nbsp; <span class="tGreen">//自左向右</span></cl-cd>
<cl-cd data-idx="70">&nbsp; &nbsp; begin1 += step;</cl-cd>
<cl-cd data-idx="71">&nbsp; &nbsp; begin2 += step;</cl-cd>
<cl-cd data-idx="72">&nbsp; &nbsp; <span class="tBlue">if</span>(begin1 &gt;= ww) begin1 = -ww;</cl-cd>
<cl-cd data-idx="73">&nbsp; &nbsp; <span class="tBlue">if</span>(begin2 &gt;= ww) begin2 = -ww;</cl-cd>
<div class="tGreen"><cl-cd data-idx="74">/* 自右向左</cl-cd>
<cl-cd data-idx="75">&nbsp; &nbsp; begin1 -= step;</cl-cd>
<cl-cd data-idx="76">&nbsp; &nbsp; begin2 -= step;</cl-cd>
<cl-cd data-idx="77">&nbsp; &nbsp; <span class="tBlue">if</span>(begin1 &lt;= -ww) begin1 = ww;</cl-cd>
<cl-cd data-idx="78">&nbsp; &nbsp; <span class="tBlue">if</span>(begin2 &lt;= -ww) begin2 = ww;</cl-cd>
<cl-cd data-idx="79">*/</cl-cd></div>
<cl-cd data-idx="80">&nbsp; &nbsp; <span class="tBlue">let</span> b2 = begin2 + (begin1 &gt;= 0 ? 1&nbsp;: -1);</cl-cd>
<cl-cd data-idx="81">&nbsp; &nbsp; mydiv.style.setProperty(<span class="tMagenta">'--begin1'</span>, begin1 + <span class="tMagenta">'px'</span>);</cl-cd>
<cl-cd data-idx="82">&nbsp; &nbsp; mydiv.style.setProperty(<span class="tMagenta">'--begin2'</span>, b2 + <span class="tMagenta">'px'</span>);</cl-cd>
<cl-cd data-idx="83">&nbsp; &nbsp; aud.paused</cl-cd>
<cl-cd data-idx="84">&nbsp; &nbsp; &nbsp; &nbsp; ? (cancelAnimationFrame(raf), mydiv.style.setProperty(<span class="tMagenta">'--state'</span>, <span class="tMagenta">'paused'</span>), vid.pause())</cl-cd>
<cl-cd data-idx="85">&nbsp; &nbsp; &nbsp; &nbsp; : (raf = requestAnimationFrame(moving), mydiv.style.setProperty(<span class="tMagenta">'--state'</span>, <span class="tMagenta">'running'</span>),vid.play());</cl-cd>
<cl-cd data-idx="86">};</cl-cd>
<cl-cd data-idx="87">&nbsp;</cl-cd>
<cl-cd data-idx="88">&lt;<span class="tDarkRed">/script</span>&gt;</cl-cd>
</div>

<h2>二、移动伪元素背景的实现机制</h2>
<p>注意:,这个机制要求帖子元素宽高尺寸等于图片实际宽高尺寸。<br><br></p>
<div class='mum'>
<cl-cd data-idx="1">&lt;<span class="tDarkRed">style</span>&gt;</cl-cd>
<cl-cd data-idx="2">#mydiv {</cl-cd>
<cl-cd data-idx="3">&nbsp; &nbsp; <span class="tBlue">margin:</span> 20px 0 20px calc(50% - 641px);</cl-cd>
<cl-cd data-idx="4">&nbsp; &nbsp; <span class="tBlue">width:</span> 1280px;</cl-cd>
<cl-cd data-idx="5">&nbsp; &nbsp; <span class="tBlue">height:</span> 800px;</cl-cd>
<cl-cd data-idx="6">&nbsp; &nbsp; <span class="tBlue">background:</span> lightblue;</cl-cd>
<cl-cd data-idx="7">&nbsp; &nbsp; <span class="tBlue">box-shadow:</span> 4px 4px 8px #000;</cl-cd>
<cl-cd data-idx="8">&nbsp; &nbsp; <span class="tBlue">overflow:</span> hidden;</cl-cd>
<cl-cd data-idx="9">&nbsp; &nbsp; <span class="tBlue">z-index:</span> 1;</cl-cd>
<cl-cd data-idx="10">&nbsp; &nbsp; <span class="tBlue">position:</span> relative;</cl-cd>
<cl-cd data-idx="11">&nbsp; &nbsp; --begin1: 0px;</cl-cd>
<cl-cd data-idx="12">&nbsp; &nbsp; --begin2: -1280px;</cl-cd>
<cl-cd data-idx="13">}</cl-cd>
<cl-cd data-idx="14">#mydiv::before , #mydiv::after {</cl-cd>
<cl-cd data-idx="15">&nbsp; &nbsp; <span class="tBlue">position:</span> absolute;</cl-cd>
<cl-cd data-idx="16">&nbsp; &nbsp; <span class="tBlue">content:</span> <span class="tMagenta">''</span>;</cl-cd>
<cl-cd data-idx="17">&nbsp; &nbsp; <span class="tBlue">inset:</span> 0;</cl-cd>
<cl-cd data-idx="18">&nbsp; &nbsp; <span class="tBlue">background:</span> url(<span class="tMagenta">'https://638183.freep.cn/638183/t24/1/prologue.jpg'</span>) no-repeat;</cl-cd>
<cl-cd data-idx="19">&nbsp; &nbsp; <span class="tBlue">z-index:</span> -2;</cl-cd>
<cl-cd data-idx="20">}</cl-cd>
<cl-cd data-idx="21">#mydiv::before {</cl-cd>
<cl-cd data-idx="22">&nbsp; &nbsp; <span class="tBlue">background-position:</span> <span class="tBlue">var</span>(--begin1) 0;</cl-cd>
<cl-cd data-idx="23">}</cl-cd>
<cl-cd data-idx="24">#mydiv::after {</cl-cd>
<cl-cd data-idx="25">&nbsp; &nbsp; <span class="tBlue">transform:</span> scale(-1, 1);</cl-cd>
<cl-cd data-idx="26">&nbsp; &nbsp; <span class="tBlue">background-position:</span> <span class="tBlue">var</span>(--begin2) 0;</cl-cd>
<cl-cd data-idx="27">}</cl-cd>
<cl-cd data-idx="28">#play {</cl-cd>
<cl-cd data-idx="29">&nbsp; &nbsp; <span class="tBlue">position:</span> absolute;</cl-cd>
<cl-cd data-idx="30">&nbsp; &nbsp; <span class="tBlue">left:</span> calc(50% - 50px);</cl-cd>
<cl-cd data-idx="31">&nbsp; &nbsp; <span class="tBlue">top:</span> 20px;</cl-cd>
<cl-cd data-idx="32">&nbsp; &nbsp; <span class="tBlue">width:</span> 100px;</cl-cd>
<cl-cd data-idx="33">&nbsp; &nbsp; <span class="tBlue">cursor:</span> pointer;</cl-cd>
<cl-cd data-idx="34">&nbsp; &nbsp; <span class="tBlue">animation:</span> rotating 5s linear infinite <span class="tBlue">var</span>(--state);</cl-cd>
<cl-cd data-idx="35">}</cl-cd>
<cl-cd data-idx="36">#vid {</cl-cd>
<cl-cd data-idx="37">&nbsp; &nbsp; <span class="tBlue">position:</span> absolute;</cl-cd>
<cl-cd data-idx="38">&nbsp; &nbsp; <span class="tBlue">right:</span> 0;</cl-cd>
<cl-cd data-idx="39">&nbsp; &nbsp; <span class="tBlue">width:</span> 40%;</cl-cd>
<cl-cd data-idx="40">&nbsp; &nbsp; <span class="tBlue">height:</span> 30%;</cl-cd>
<cl-cd data-idx="41">&nbsp; &nbsp; <span class="tBlue">object-fit:</span> cover;</cl-cd>
<cl-cd data-idx="42">&nbsp; &nbsp; <span class="tBlue">mix-blend-mode:</span> screen;</cl-cd>
<cl-cd data-idx="43">&nbsp; &nbsp; <span class="tBlue">transform:</span> rotate(-15deg);</cl-cd>
<cl-cd data-idx="44">&nbsp; &nbsp; <span class="tBlue">pointer-events:</span> none;</cl-cd>
<cl-cd data-idx="45">}</cl-cd>
<cl-cd data-idx="46">@keyframes rotating { to { <span class="tBlue">transform:</span> rotate(360deg); } }</cl-cd>
<cl-cd data-idx="47">&lt;<span class="tDarkRed">/style</span>&gt;</cl-cd>
<cl-cd data-idx="48">&nbsp;</cl-cd>
<cl-cd data-idx="49">&lt;<span class="tDarkRed">div</span> <span class="tRed">id</span>=<span class="tMagenta">"mydiv"</span>&gt;</cl-cd>
<cl-cd data-idx="50">&nbsp; &nbsp; &lt;<span class="tDarkRed">audio</span> <span class="tRed">id</span>=<span class="tMagenta">"aud"</span> src=<span class="tMagenta">"https://music.163.com/song/media/outer/url?<span class="tRed">id</span>=2923186"</span> autoplay&gt;&lt;<span class="tDarkRed">/audio</span>&gt;</cl-cd>
<cl-cd data-idx="51">&nbsp; &nbsp; &lt;<span class="tDarkRed">video</span> <span class="tRed">id</span>=<span class="tMagenta">"vid"</span> src=<span class="tMagenta">"https://img.tukuppt.com/video_show/7165162/00/19/81/5f154503b457d.mp4"</span> muted loop&gt;&lt;<span class="tDarkRed">/video</span>&gt;</cl-cd>
<cl-cd data-idx="52">&nbsp; &nbsp; &lt;<span class="tDarkRed">img</span> <span class="tRed">id</span>=<span class="tMagenta">"play"</span> src=<span class="tMagenta">"https://638183.freep.cn/638183/small/4yc.png"</span> alt=<span class="tMagenta">""</span> /&gt;</cl-cd>
<cl-cd data-idx="53">&lt;<span class="tDarkRed">/div</span>&gt;</cl-cd>
<cl-cd data-idx="54">&nbsp;</cl-cd>
<cl-cd data-idx="55">&lt;<span class="tDarkRed">script</span>&gt;</cl-cd>
<cl-cd data-idx="56"><span class="tBlue">var</span> ww = mydiv.offsetWidth;</cl-cd>
<cl-cd data-idx="57"><span class="tBlue">var</span> step = 0.5, begin1 = 0, raf = null;</cl-cd>
<cl-cd data-idx="58">aud.loo = false;</cl-cd>
<cl-cd data-idx="59">play.onclick = () =&gt; aud.paused ? aud.play() : aud.pause();</cl-cd>
<cl-cd data-idx="60">aud.onpause = aud.onplaying = () =&gt; mState();</cl-cd>
<cl-cd data-idx="61">aud.onended = () =&gt; { aud.play(); cancelAnimationFrame(raf); }</cl-cd>
<cl-cd data-idx="62">aud.onseeked = () =&gt; cancelAnimationFrame(raf);</cl-cd>
<cl-cd data-idx="63"><span class="tBlue">var</span> moving = () =&gt; {</cl-cd>
<cl-cd data-idx="64">&nbsp; &nbsp; <span class="tGreen">//自左向右</span></cl-cd>
<cl-cd data-idx="65">&nbsp; &nbsp; begin1 += step;</cl-cd>
<cl-cd data-idx="66">&nbsp; &nbsp; <span class="tBlue">if</span>(begin1 &gt;= ww) begin1 = -ww;</cl-cd>
<div class="tGreen"><cl-cd data-idx="67">&nbsp; &nbsp; /* 自右向左</cl-cd>
<cl-cd data-idx="68">&nbsp; &nbsp; begin1 -= step;</cl-cd>
<cl-cd data-idx="69">&nbsp; &nbsp; <span class="tBlue">if</span>(begin1 &lt;= -ww) begin1 = ww;</cl-cd>
<cl-cd data-idx="70">&nbsp; &nbsp; */</cl-cd></div>
<cl-cd data-idx="71">&nbsp; &nbsp; begin2 = begin1 &gt;= 0 ? -1 * (begin1 - ww + 1) : begin2 = -1 * (begin1 + ww - 1);</cl-cd>
<cl-cd data-idx="72">&nbsp; &nbsp; mydiv.style.setProperty(<span class="tMagenta">'--begin1'</span>, begin1 + <span class="tMagenta">'px'</span>);</cl-cd>
<cl-cd data-idx="73">&nbsp; &nbsp; mydiv.style.setProperty(<span class="tMagenta">'--begin2'</span>, begin2 + <span class="tMagenta">'px'</span>);</cl-cd>
<cl-cd data-idx="74">&nbsp; &nbsp; aud.paused ? cancelAnimationFrame(raf) : raf = requestAnimationFrame(moving);</cl-cd>
<cl-cd data-idx="75">};</cl-cd>
<cl-cd data-idx="76"><span class="tBlue">var</span> mState = () =&gt; {</cl-cd>
<cl-cd data-idx="77">&nbsp; &nbsp; aud.paused</cl-cd>
<cl-cd data-idx="78">&nbsp; &nbsp; &nbsp; &nbsp; ? (mydiv.style.setProperty(<span class="tMagenta">'--state'</span>, <span class="tMagenta">'paused'</span>), cancelAnimationFrame(raf), vid.pause())</cl-cd>
<cl-cd data-idx="79">&nbsp; &nbsp; &nbsp; &nbsp; : (mydiv.style.setProperty(<span class="tMagenta">'--state'</span>, <span class="tMagenta">'running'</span>), raf = requestAnimationFrame(moving), vid.play());</cl-cd>
<cl-cd data-idx="80">};</cl-cd>
<cl-cd data-idx="81">&lt;<span class="tDarkRed">/script</span>&gt;</cl-cd>
</div>

马黑黑 发表于 2024-4-7 16:52

欲查看效果,可以讲上述代码逐一复制到 pencil code 运行,或逐一保存为本地 .html 文档后双击运行

马黑黑 发表于 2024-4-7 16:56

两种实现机制均已在计算机浏览环境、部分虚拟移动设备和少量移动设备真机浏览环境下测试通过。发现效果异常的,烦请反馈一下,反馈时请说清楚浏览环境(诸如电脑还是手机、平板、机顶盒,以及浏览器名称、版本等信息)

庶民 发表于 2024-4-7 17:41

支持一下。

马黑黑 发表于 2024-4-7 17:48

庶民 发表于 2024-4-7 17:41
支持一下。

感谢支持

亚伦影音工作室 发表于 2024-4-7 17:50

到位,必须点赞!

马黑黑 发表于 2024-4-7 18:28

亚伦影音工作室 发表于 2024-4-7 17:50
到位,必须点赞!

蟹蟹

红影 发表于 2024-4-7 19:32

两个都去看了效果,十分完美{:4_199:}

红影 发表于 2024-4-7 19:34

通过伪元素实现的图图滚动,而且可以加入和控制视频,很赞{:4_199:}

南无月 发表于 2024-4-7 20:42

马黑黑 发表于 2024-4-7 16:56
两种实现机制均已在计算机浏览环境、部分虚拟移动设备和少量移动设备真机浏览环境下测试通过。发现效果异常 ...

平板还未试过。。这就去充个电先。。一会试下。{:4_173:}

南无月 发表于 2024-4-7 20:42

音频联动控制中,包含了一个视频的同步控制。
这个最实用了。{:4_199:}

马黑黑 发表于 2024-4-7 22:08

南无月 发表于 2024-4-7 20:42
音频联动控制中,包含了一个视频的同步控制。
这个最实用了。

视频和音频联动控制,我们有诸多方式的

马黑黑 发表于 2024-4-7 22:08

南无月 发表于 2024-4-7 20:42
平板还未试过。。这就去充个电先。。一会试下。

试试也好

南无月 发表于 2024-4-7 22:09

马黑黑 发表于 2024-4-7 22:08
视频和音频联动控制,我们有诸多方式的

{:4_173:}模板里有的方式就是最方便

马黑黑 发表于 2024-4-7 22:10

南无月 发表于 2024-4-7 22:09
模板里有的方式就是最方便

这两个需要视频有 id, id="vid"

南无月 发表于 2024-4-7 22:10

马黑黑 发表于 2024-4-7 22:08
试试也好

平板试了,十分流畅,没有问题。。
{:4_187:}

马黑黑 发表于 2024-4-7 22:11

南无月 发表于 2024-4-7 22:10
平板试了,十分流畅,没有问题。。

安卓平板吧

小辣椒 发表于 2024-4-7 22:45

都电脑测试了一下,非常流畅{:4_199:}

马黑黑 发表于 2024-4-7 23:04

小辣椒 发表于 2024-4-7 22:45
都电脑测试了一下,非常流畅

辛苦{:4_190:}

南无月 发表于 2024-4-8 17:44

马黑黑 发表于 2024-4-7 22:11
安卓平板吧

{:4_170:}我回去看看
页: [1] 2 3
查看完整版本: 单图背景水平方向无缝循环滚动模板(两种实现机制)