|
|
这不是的。我把1#的代码复制了一份,加上了缺失的部分(79 ~ 96)
- <style>
- @import url(https://fonts.googleapis.com/css?family=Long+Cang&display=swap);
- #oBlk {
- width: 1100px;
- height: 786px;
- background: url no-repeat center/cover;
- padding: 32px 32px;
- place-items: center;
- position: relative;
- box-shadow: 3px 3px 8px darkgray;
- overflow: hidden;
- border-radius: 24px;
- display: grid;
- place-items: center;
- grid-template-rows: 90% 10%;
- grid-template-columns: 100%;
- margin: 30px auto 30px calc(50% - 681px);
- position: relative;
- #pa {
- width: 100%;
- height: 100%;
- border: 4px dotted gray;
- overflow: hidden;
- position: relative;
- #son {
- position: absolute;
- height: 100%;
- white-space: nowrap;
- animation: scroll 55s linear infinite;
- &:hover {
- animation-play-state: paused;
- }
- img {
- height: 100%;
- margin: 2px;
- }
- }
- }
- #text-layer {
- z-index: 99;
- font-size: 1.35em;
- color: brown;
- background-color: transparent;
- margin-top: 32px;
- border-radius: 6px;
- max-width: 800px;
- font-family: 'Long Cang';
- padding: 8px;
- cursor: pointer;
- }
- }
- @keyframes scroll {
- to {
- transform: translateX(-50%);
- }
- }
- </style>
- <div id="oBlk">
- <div id="pa">
- <div id="son">
- <img src="https://pan.suyanw.cn/view.php/1519882c59ee4ce6a7022bee4f9fc8ea.jpg" loading="lazy" alt="">
- <img src="https://pan.suyanw.cn/view.php/912ffa6aa98dbb6510c3291a07b9c5cd.jpg" loading="lazy" alt="">
- <img src="https://pan.suyanw.cn/view.php/17be93ae9fc76acf4eebf8332ce2c5fa.jpg" loading="lazy" alt="">
- <img src="https://pan.suyanw.cn/view.php/1519882c59ee4ce6a7022bee4f9fc8ea.jpg" loading="lazy" alt="">
- <img src="https://pan.suyanw.cn/view.php/912ffa6aa98dbb6510c3291a07b9c5cd.jpg" loading="lazy" alt="">
- <img src="https://pan.suyanw.cn/view.php/17be93ae9fc76acf4eebf8332ce2c5fa.jpg" loading="lazy" alt="">
- </div>
- </div>
- <div id="text-layer"> 图一是微缩城的大门。 图二微缩城入口处,有一座格列佛金属雕像,看过《格列佛游记》的都知道,他是游记小说里第一位进入“微缩小人国”的人。图三是城内景观的一小部分。 </div>
- </div>
- <audio src="https://music.163.com/song/media/outer/url?id=28606435.mp3" loop="" autoplay=""></audio>
- <script>
- const synthObj = window.speechSynthesis;
- const mObj = document.querySelector("audio");
- const dTxt = document.querySelector('#text-layer');
- dTxt.onmouseenter = (e) => {
- synthObj.cancel();
- mObj.pause();
- if (!e.currentTarget.innerHTML) return;
- let voiceObj = new SpeechSynthesisUtterance(e.currentTarget.innerHTML);
- voiceObj.lang = "zh-CN";
- voiceObj.rate = 0.9; //语速,数字越小读得越慢
- synthObj.speak(voiceObj);
- };
- dTxt.onmouseout = () => {
- synthObj.cancel();
- mObj.play();
- }
- </script>
复制代码 |
|