{"id":11293,"date":"2024-07-29T01:02:44","date_gmt":"2024-07-28T17:02:44","guid":{"rendered":"https:\/\/www.zhangxinxu.com\/wordpress\/?p=11293"},"modified":"2024-07-29T15:07:16","modified_gmt":"2024-07-29T07:07:16","slug":"js-mp3-audio-fadein-fadeout-convert","status":"publish","type":"post","link":"https:\/\/www.zhangxinxu.com\/wordpress\/2024\/07\/js-mp3-audio-fadein-fadeout-convert\/","title":{"rendered":"\u72ec\u5bb6\uff0cMP3\u97f3\u9891\u6de1\u5165\u6de1\u51fa\u64ad\u653e\u548c\u8f6c\u6362\u7684JS\u5b9e\u73b0"},"content":{"rendered":"<p>by <a href=\"https:\/\/www.zhangxinxu.com\/\">zhangxinxu<\/a> from <a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/?p=11293\">https:\/\/www.zhangxinxu.com\/wordpress\/?p=11293<\/a><br \/>\n\u672c\u6587\u53ef\u5168\u6587\u8f6c\u8f7d\uff0c\u72ec\u7acb\u57df\u540d\u4e2a\u4eba\u7f51\u7ad9\u65e0\u9700\u6388\u6743\uff0c\u4f46\u9700\u8981\u4fdd\u7559\u539f\u4f5c\u8005\u3001\u51fa\u5904\u4ee5\u53ca\u6587\u4e2d\u94fe\u63a5\uff0c\u4efb\u4f55\u7f51\u7ad9\u5747\u53ef\u6458\u8981\u805a\u5408\uff0c\u5546\u7528\u8bf7\u8054\u7cfb\u6388\u6743\u3002<\/p>\n<p><script>window.wxShareImgUrl = 'https:\/\/www.zhangxinxu.com\/study\/image\/share\/202407-audio-fade.png';<\/script><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202407\/cover-fade.png\" width=\"414\" height=\"263\" alt=\"\u5c01\u9762\u5360\u4f4d\u56fe\" class=\"alignright clip thumb size-medium\" \/><\/p>\n<h3>\u4e00\u3001\u9700\u6c42\u80cc\u666f<\/h3>\n<p>    \u5e0c\u671b\u7279\u6548\u97f3\u53ef\u4ee5\u6709\u6de1\u5165\u6de1\u51fa\u6548\u679c\uff0c\u540c\u65f6\u80fd\u591f\u5728\u89c6\u9891\u5408\u6210\u7684\u65f6\u5019\u4f53\u73b0\u5728\u97f3\u8f68\u4e2d\u3002<\/p>\n<h3>\u4e8c\u3001\u64ad\u653e\u6de1\u5165\u6de1\u51fa<\/h3>\n<p>    \u5148\u8bb2\u4e0b\u504f\u6d45\u5c42\u5e94\u7528\u7684\u6280\u672f\u5b9e\u73b0\uff0c\u90a3\u5c31\u662f\u64ad\u653e\u6de1\u5165\u6de1\u51fa\u3002<\/p>\n<h4>1. \u4f7f\u7528howlerjs\u5b9e\u73b0<\/h4>\n<p>    howlerjs\u8fd9\u4e2a\u9879\u76ee\uff08<a href=\"https:\/\/github.com\/goldfire\/howler.js\" target=\"_blank\" rel=\"nofollow noopener\">https:\/\/github.com\/goldfire\/howler.js<\/a>\uff09\u6211\u591a\u6b21\u63d0\u5230\u8fc7\uff0c\u51e1\u662f\u97f3\u9891\u64ad\u653e\u7684\u9700\u6c42\uff08\u9664\u4e86\u90a3\u79cd\u7b80\u5355\u7684\u70b9\u51fb\u64ad\u653e\uff09\uff0c\u65e0\u9700\u4efb\u4f55\u8fdf\u7591\uff0c\u4e5f\u4e0d\u7528\u8003\u8651\u5176\u4ed6\uff0c\u5c31\u662f\u8981howlerjs\u3002<\/p>\n<p>    \u4e24\u4e09\u4e07Star\u7684\u9879\u76ee\uff0c\u54c1\u8d28\u4fdd\u8bc1\u3002<\/p>\n<p>    \u4e0b\u9762\u6f14\u793a\u4e0b\u5982\u4f55\u5b9e\u73b0\u3002<\/p>\n<p>    \u5047\u8bbe\u9875\u9762\u4e0a\u6709\u4e2a\u6309\u94ae\uff0c\u70b9\u51fb\u6309\u94ae\u64ad\u653e\u67d0\u97f3\u9891\uff0cHTML\u793a\u610f\uff1a<\/p>\n<pre>&lt;button id=\"button\"&gt;\u70b9\u51fb\u64ad\u653e&lt;\/button&gt;<\/pre>\n<p>    \u5219\u4e0b\u9762\u51e0\u884cJavaScript\u4ee3\u7801\u53ef\u4ee5\u5b9e\u73b0\u97f3\u9891\u64ad\u653e\u6de1\u5165\uff0c\u7ed3\u675f\u6de1\u51fa\u7684\u6548\u679c\u3002<\/p>\n<pre>const url = '.\/htmlbook.wav';\r\n\r\nconst sound = new Howl({\r\n    src: [url]\r\n});\r\n\r\n\/\/ \u70b9\u51fb\u6309\u94ae\uff0c\u97f3\u9891\u6de1\u5165\u6de1\u51fa\u64ad\u653e\r\nbutton.onclick = function () {\r\n    sound.play();\r\n    sound.fade(0, 1, 1000);\r\n    setTimeout(() =&gt; {\r\n        sound.fade(1, 0, 1000);\r\n    }, sound.duration() * 1000 - 1500);\r\n}<\/pre>\n<p>    \u6839\u636e\u6211\u67e5\u627e\u7684\u8d44\u6599\uff0chowlerjs\u5e76\u672a\u63d0\u4f9b\u5185\u7f6e\u7684\u7ed3\u5c3e\u6de1\u51fa\u65b9\u6cd5\uff0c\u53ea\u6709\u4e00\u4e2afade()\u65b9\u6cd5\uff0c\u56e0\u6b64\uff0c\u7ed3\u675f\u65f6\u5019\u58f0\u97f3\u6de1\u51fa\u4f7f\u7528\u4e86\u5b9a\u65f6\u5668\u3002\u800c\u4e4b\u6240\u4ee5\u5b9a\u65f6\u5668offset\u7684\u65f6\u95f4\u662f1500ms\u800c\u4e0d\u662f\u6de1\u51fa\u76841000ms\u65f6\u95f4\uff0c\u662f\u56e0\u4e3a\u6848\u4f8b\u4f7f\u7528\u7684htmlbook.wav\u672b\u5c3e\u6709\u4e00\u6bb5\u58f0\u97f3\u662f\u9759\u97f3\uff0c\u4e3a\u4e86\u8ba9\u6de1\u51fa\u6548\u679c\u660e\u663e\uff0c\u624d\u5982\u6b64\u5904\u7406\u7684\uff0c\u4e0d\u4ee3\u8868\u901a\u7528\u573a\u666f\u3002<\/p>\n<p>    \u773c\u89c1\u4e3a\u5b9e\uff0c\u60a8\u53ef\u4ee5\u72e0\u72e0\u5730\u70b9\u51fb\u8fd9\u91cc\uff1a<a href=\"https:\/\/www.zhangxinxu.com\/study\/202407\/howler-fade-play-demo.php\" rel=\"noopener\" target=\"_blank\">\u4f7f\u7528Howler.js\u5b9e\u73b0\u97f3\u9891\u64ad\u653e\u6de1\u5165\u6de1\u51fademo<\/a><\/p>\n<p>\u70b9\u51fb\u4e0b\u56fe\u6240\u793a\u7684\u6309\u94ae\uff0c\u5c31\u53ef\u4ee5\u542c\u5230WAV\u97f3\u9891\u58f0\u97f3fade\u64ad\u653e\u7684\u6548\u679c\u4e86\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202407\/2024-07-26_224626.png\" width=\"426\" height=\"227\" alt=\"\u97f3\u9891\u64ad\u653edemo\u793a\u610f\" class=\"alignnone size-medium\" \/><\/p>\n<h4>2. \u4f7f\u7528\u539f\u751f\u7684GainNode\u5b9e\u73b0<\/h4>\n<p>   JS Web Audio API\u63d0\u4f9b\u4e86\u539f\u751f\u7684\u97f3\u91cf\u52a8\u6001\u51fd\u6570\u53d8\u5316\u65b9\u6cd5\u3002\u5305\u62ec\uff1a<\/p>\n<ul>\n<li>linearRampToValueAtTime() \u97f3\u91cf\u7ebf\u6027\u53d8\u5316<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202407\/2024-7-24_152319.png\" width=\"121\" height=\"192\" alt=\"\u7ebf\u6027\u97f3\u91cf\u53d8\u5316\u793a\u610f\u56fe\">\n        <\/li>\n<li>exponentialRampToValueAtTime() \u97f3\u91cf\u6307\u6570\u53d8\u5316<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202407\/2024-7-24_152531.png\" width=\"119\" height=\"178\" alt=\"\u97f3\u91cf\u6307\u6570\u53d8\u5316\u793a\u610f\u56fe\">\n        <\/li>\n<li>setValueCurveAtTime() \u97f3\u91cf\u66f2\u7ebf\u53d8\u5316<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202407\/2024-7-24_152622.png\" width=\"118\" height=\"181\" alt=\"\u97f3\u91cf\u66f2\u7ebf\u53d8\u5316\u793a\u610f\u56fe\">\n        <\/li>\n<li>setTargetAtTime() \u6307\u6570\u7ea7\u97f3\u91cf\u53d8\u5316\uff0c\u65e0\u9650\u63a5\u8fd1\u3002<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202407\/2024-7-24_154258.png\" width=\"136\" height=\"187\" alt=\"\u6307\u6570\u63a5\u8fd1\u53d8\u5316\u793a\u610f\u56fe\">\n        <\/li>\n<li>setValueAtTime() \u5373\u65f6\u6539\u53d8\u97f3\u91cf\u3002<\/li>\n<\/ul>\n<p>    \u4e0b\u9762\uff0c\u6211\u4eec\u4f7f\u7528GainNode\u5bf9\u8c61\u548c<code>linearRampToValueAtTime()<\/code>\u65b9\u6cd5\u793a\u610f\u5982\u4f55\u5b9e\u73b0\u97f3\u9891\u64ad\u653e\u9996\u5c3e\u6de1\u5165\u6de1\u51fa\u6548\u679c\uff0c\u548c\u4e0a\u9762\u6309\u94ae\u540c\u6837\u7684HTML\u4ee3\u7801\uff0c\u5c31\u4e00\u4e2a\u6309\u94ae\uff0c\u7136\u540eJS\u4ee3\u7801\u5982\u4e0b\u6240\u793a\u3002<\/p>\n<pre>const url = '.\/htmlbook.wav';\r\n\r\n\/\/ \u70b9\u51fb\u6309\u94ae\uff0c\u97f3\u9891\u6de1\u5165\u6de1\u51fa\u64ad\u653e\r\nbutton.onclick = function () {\r\n    \/\/ \u8bf7\u6c42\u6570\u636e\r\n    fetch(url).then(res =&gt; res.arrayBuffer()).then(buffer =&gt; {\r\n        const audioContext = new AudioContext();\r\n        audioContext.decodeAudioData(buffer, function (audioBuffer) {\r\n            const source = audioContext.createBufferSource();\r\n            const gainNode = audioContext.createGain();\r\n            \/\/ \u8d77\u59cb\u97f3\u91cf\u9759\u97f3\r\n            gainNode.gain.value = 0;\r\n            gainNode.connect(audioContext.destination);\r\n            \/\/ buffer\u6570\u636e\u8bbe\u7f6e\r\n            source.buffer = audioBuffer;\r\n            source.connect(gainNode);\r\n            source.start();\r\n\r\n            gainNode.gain.linearRampToValueAtTime(1.0, audioContext.currentTime + 1);\r\n\r\n            \/\/ \u65f6\u957f\u8ba1\u7b97\r\n            const duration = audioBuffer.duration;\r\n\r\n            setTimeout(() =&gt; {\r\n                gainNode.gain.linearRampToValueAtTime(0.01, audioContext.currentTime + 1);\r\n            }, duration * 1000 - 1200);\r\n        });\r\n    });\r\n}<\/pre>\n<p>\u6b64\u65f6\uff0c\u70b9\u51fb\u6309\u94ae\uff0c\u5c31\u53ef\u4ee5\u542c\u5230\u58f0\u97f3\u6de1\u5165\u6de1\u51fa\u64ad\u653e\u7684\u6548\u679c\u4e86\u3002\u4f8b\u5982\uff0c\u70b9\u51fb\u4e0b\u9762\u8fd9\u4e2a\u6309\u94ae\uff1a<\/p>\n<p><button id=\"button\" style=\"padding:6px 18px;\">\u70b9\u51fb\u64ad\u653e<\/button><\/p>\n<p><script type=\"module\">var url=\"\/study\/202407\/htmlbook.wav\";button.onclick=function(){fetch(url).then(function(c){return c.arrayBuffer()}).then(function(c){var a=new AudioContext;a.decodeAudioData(c,function(e){var d=a.createBufferSource(),b=a.createGain();b.gain.value=0;b.connect(a.destination);d.buffer=e;d.connect(b);d.start();b.gain.linearRampToValueAtTime(1,a.currentTime+1);setTimeout(function(){b.gain.linearRampToValueAtTime(.01,a.currentTime+1)},1E3*e.duration-1200)})})};<\/script><\/p>\n<p>\u5982\u679c\u6ca1\u6709\u6548\u679c\uff0c\u591a\u534a\u662f\u5728\u7b2c\u4e09\u65b9\u7f51\u7ad9\uff0c\u72e0\u51fb\u8fd9\u91cc\u8bbf\u95ee\u5b9e\u4f8b\uff1a<a href=\"https:\/\/www.zhangxinxu.com\/study\/202407\/js-gainnode-fade-play-demo.php\" rel=\"noopener\" target=\"_blank\">\u4f7f\u7528GainNode\u5b9e\u73b0\u97f3\u9891\u6de1\u5165\u6de1\u51fa\u64ad\u653edemo<\/a><\/p>\n<p><strong>\u8865\u5145\u8bf4\u660e<\/strong><\/p>\n<p>\u6839\u636e\u81ea\u5df1\u548c\u5b98\u65b9demo\u6d4b\u8bd5\uff0c<code>exponentialRampToValueAtTime()<\/code>\u51fd\u6570\u6267\u884c\u7684\u65f6\u5019\uff0c\u58f0\u97f3\u662f\u7a81\u7136\u53d8\u5316\u7684\uff0c\u4e0d\u77e5\u9053\u662f\u4e0d\u662f\u6211\u8bbe\u5907\u7684\u95ee\u9898\u3002<\/p>\n<h3>\u4e09\u3001\u97f3\u9891\u5e95\u5c42\u6de1\u5165\u6de1\u51fa\u8f6c\u6362<\/h3>\n<p>    \u5982\u679c\u6211\u4eec\u5e0c\u671b\u5bf9\u97f3\u9891\u8fdb\u884c\u8f6c\u6362\uff0c\u4e5f\u5c31\u662f\u76f4\u63a5\u628a\u539f\u59cb\u97f3\u9891\u8f6c\u6362\u6210\u6de1\u5165\u6de1\u51fa\u7684\u97f3\u9891\uff0c\u5c31\u9700\u8981\u5904\u7406\u97f3\u9891\u7684AudioBuffer\u6570\u636e\u3002<\/p>\n<p>    \u8fd9\u4e2a\u5c31\u76f8\u5bf9\u6df1\u5165\u4e9b\u4e86\uff0c\u539f\u7406\u4ec0\u4e48\u7684\u5927\u5bb6\u5e94\u8be5\u90fd\u4e0d\u5173\u5fc3\uff0c\u4e0d\u5570\u55e6\uff0c3,2,1\uff0c\u76f4\u63a5\u4e0a\u4ee3\u7801\uff0c\u89c1\uff1a<\/p>\n<pre>const sliceAudio = function (buffer, start, end, fadeIn = 0, fadeOut = 0) {\r\n  const sampleRate = buffer.sampleRate;\r\n  const audioContext = new AudioContext();\r\n\r\n  const length = Math.round((end - start) * sampleRate);\r\n  const offset = Math.round(start * sampleRate);\r\n  const newBuffer = audioContext.createBuffer(buffer.numberOfChannels, length, sampleRate);\r\n\r\n  for (let channel = 0; channel &lt; buffer.numberOfChannels; channel++) {\r\n    const inputData = buffer.getChannelData(channel);\r\n    const outputData = newBuffer.getChannelData(channel);\r\n\r\n    for (let i = 0; i &lt; length; i++) {\r\n      outputData[i] = inputData[offset + i];\r\n\r\n      \/\/ Apply fade in\r\n      if (i &lt; fadeIn * sampleRate) {\r\n        outputData[i] *= i \/ (fadeIn * sampleRate);\r\n      }\r\n\r\n      \/\/ Apply fade out\r\n      if (i &gt; length - fadeOut * sampleRate) {\r\n        outputData[i] *= (length - i) \/ (fadeOut * sampleRate);\r\n      }\r\n    }\r\n  }\r\n\r\n  return newBuffer;\r\n}<\/pre>\n<p>    \u5176\u4e2d\uff1a<\/p>\n<dl>\n<dt><strong>buffer<\/strong><\/dt>\n<dd>\u9700\u8981\u8f6c\u6362\u7684AudioBuffer\u6570\u636e<\/dd>\n<dt><strong>start<\/strong><\/dt>\n<dd>\u97f3\u9891\u590d\u5236\u8d77\u59cb\u65f6\u95f4<\/dd>\n<dt><strong>end<\/strong><\/dt>\n<dd>\u97f3\u9891\u590d\u5236\u7ed3\u675f\u65f6\u95f4\uff0c\u5982\u679c\u7ed3\u675f\u65f6\u95f4\u5c31\u662f\u97f3\u9891\u65f6\u957f\uff0c\u6b64\u53c2\u6570\u53ef\u4ee5\u8bbe\u7f6e\u4e3a<code>buffer.duration<\/code>\u3002<\/dd>\n<dt><strong>fadeIn<\/strong><\/dt>\n<dd>\u5f00\u5934\u6de1\u5165\u7684\u65f6\u957f\uff0c\u5355\u4f4d\u662f\u79d2<\/dd>\n<dt><strong>fadeOut<\/strong><\/dt>\n<dd>\u7ed3\u675f\u6de1\u51fa\u7684\u65f6\u957f\uff0c\u5355\u4f4d\u662f\u79d2<\/dd>\n<\/dl>\n<p>    \u5177\u4f53\u5982\u4f55\u5e94\u7528\u5462\uff1f\u53ef\u4ee5\u53c2\u89c1\u4e0b\u9762\u7684\u6f14\u793a\u9875\u9762\u3002<\/p>\n<p>    \u60a8\u53ef\u4ee5\u72e0\u72e0\u5730\u70b9\u51fb\u8fd9\u91cc\uff1a<a href=\"https:\/\/www.zhangxinxu.com\/study\/202407\/js-arraybuffer-audio-fade-demo.php\" rel=\"noopener\" target=\"_blank\">MP3\/Wav AudioBuffer\u8f6c\u6362\u6210\u6de1\u5165\u6de1\u51fa\u97f3\u9891demo<\/a><\/p>\n<p>    \u70b9\u51fb\u201c\u8f6c\u6362\u201d\u6309\u94ae\uff0c\u4e0b\u9762\u7684\u97f3\u9891\u64ad\u653e\u5668\u64ad\u653e\u7684\u5c31\u662f\u88ab\u6de1\u5165\u6de1\u51fa\u5904\u7406\u540e\u7684\u97f3\u9891\uff0c\u70b9\u51fb\u73b0\u5728\u6211\u4eec\u53ef\u4ee5\u5f97\u5230\u8fd9\u4e2a\u65b0\u7684WAV\u97f3\u9891\u6587\u4ef6\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202407\/2024-07-26_230239.png\" width=\"535\" height=\"363\" alt=\"\u6de1\u5165\u6de1\u51fa\u8f6c\u6362\u622a\u56fe\u793a\u610f\" class=\"alignnone size-medium\" \/><\/p>\n<p>    \u4e3b\u8981\u5e94\u7528\u4ee3\u7801\u793a\u610f\uff08\u4ece\u70b9\u51fb\u6309\u94ae\u5f00\u59cb\uff09\uff1a<\/p>\n<pre>const url = '.\/htmlbook.wav';\r\n\r\n\/\/ \u70b9\u51fb\u6309\u94ae\uff0c\u97f3\u9891\u6de1\u5165\u6de1\u51fa\u64ad\u653e\r\nbutton.onclick = function () {\r\n  \/\/ \u8bf7\u6c42\u6570\u636e\r\n  fetch(url).then(res =&gt; res.arrayBuffer()).then(buffer =&gt; {\r\n    const audioContext = new AudioContext();\r\n    audioContext.decodeAudioData(buffer, (audioBuffer) =&gt; {\r\n      const convertBuffer = sliceAudio(audioBuffer, 0, audioBuffer.duration, 1, 1.5);\r\n      \/\/ \u8f6cblob WAV\r\n      const wavBuffer = audioBufferToWav(convertBuffer);\r\n      const wavBlob = new Blob([wavBuffer], { type: 'audio\/wav' });\r\n      const urlBlob = URL.createObjectURL(wavBlob);\r\n\r\n      \/\/ create download link and append to Dom\r\n      const downloadLink = document.createElement('a');\r\n      downloadLink.href = urlBlob;\r\n      downloadLink.setAttribute('download', 'htmlbook-fade.wav');\r\n      downloadLink.textContent = '\u4e0b\u8f7d';\r\n\r\n      \/\/ \u6309\u94ae\u7981\u7528\r\n      this.disabled = true;\r\n      \/\/ \u8bd5\u542c\u652f\u6301\r\n      audio.src = urlBlob;\r\n      \/\/ \u4e0b\u8f7d\u652f\u6301\r\n      audio.after(downloadLink);\r\n    });\r\n  });\r\n}<\/pre>\n<p>    \u66f4\u5b8c\u6574\u7684\u5904\u7406\u4ee3\u7801\uff0c\u53c2\u89c1<a href=\"https:\/\/www.zhangxinxu.com\/study\/202407\/js-arraybuffer-audio-fade-demo.php\" rel=\"noopener\" target=\"_blank\">\u4e0a\u9762\u7684\u6f14\u793a\u9875\u9762<\/a>\u7684\u6e90\u4ee3\u7801\uff08\u6f14\u793a\u9875\u9762\u7701\u7565\u4e86AudioBuffer\u8f6cWav blob\u6570\u636e\u7684\u4ee3\u7801\uff09\u3002<\/p>\n<h3>\u56db\u3001\u6765\u4e86\u6765\u4e86\uff0c\u672c\u5468\u7684\u788e\u788e\u5ff5<\/h3>\n<p>\u5468\u4e09\u7684\u65f6\u5019\uff0c\u6211\u7684\u65b0\u4e66\u5df2\u7ecf\u662f\u4eac\u4e1c\u65e5\u699c\u7b2c1\u4e86\uff0c\u770b\u6765\u53e3\u7891\u53d1\u9175\u4e86\uff0c\u611f\u8c22\u5927\u5bb6\u7684\u6b63\u7248\u652f\u6301\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202407\/2024-7-26_230615.png\" width=\"276\" height=\"610\" alt=\"\u65e5\u699c\u7b2c1\" class=\"alignnone size-medium\" \/><\/p>\n<p>CSS\u4e16\u754c\u7cbe\u8bb2\u89c6\u9891\u7ee7\u7eed\u66f4\u65b0\uff0c\u5173\u4e8e\u65b0\u4e66\u4ecb\u7ecd\u7684\u6587\u5b57\u7248\uff0c\u5728\u81ea\u5df1\u535a\u5ba2\u548c\u516c\u4f17\u53f7\u4e5f\u90fd\u53d1\u5e03\u4e86\u3002<\/p>\n<p>\u89c6\u9891\u4e0b\u9762\u90fd\u662f\u6709\u62bd\u5956\u6d3b\u52a8\u7684\u3002<\/p>\n<p>\u76ee\u524d\u7d2f\u8ba1\u9001\u51fa\u53bb14\u672c\u300aHTML\u5e76\u4e0d\u7b80\u5355\u300b\uff0c3\u672c\u300aCSS\u65b0\u4e16\u754c\u300b\uff0c\u8fd8\u5305\u4e86400~500\u7684\u7ea2\u5305\uff0c\u524d\u671f\u6d3b\u52a8\u6210\u672c\u90fd1000\u5757\u94b1\u51fa\u53bb\u4e86\u3002<\/p>\n<p>\u5173\u952e\u8fd8\u8981\u770b\u540e\u671f\u5982\u4f55\u4e86\uff0c\u53ea\u662f\u56fd\u5185\u76d7\u7248\u76db\u884c\uff0c\u597d\u5fe7\u8651\u554a\u3002<\/p>\n<p>\u53e6\u5916\uff0c\u4e0d\u5c11\u4eba\u63d0\u4f9b\u4e86\u5b9d\u8d35\u7684\u52d8\u8bef\uff0c\u7279\u522b\u611f\u8c22\uff0c\u91cd\u5370\u7684\u65f6\u5019\u4f1a\u8c03\u6574\u3002<\/p>\n<p>\u4e0a\u5468\u662f\u5e73\u51e1\u7684\u4e00\u5468\uff0c\u5c0f\u670b\u53cb\u53bb\u4e86\u6d66\u4e1c\u56fe\u4e66\u9986\uff0c\u6e38\u4e86\u6cf3\uff0c\u5bb6\u91cc\u9886\u5bfc\u5468\u516d\u8fd8\u542c\u4e86\u83ab\u6587\u851a\u7684\u6f14\u5531\u4f1a\uff0c\u6211\u5462\u7ee7\u7eed\u62bd\u7a7a\u9493\u9c7c\u3002<\/p>\n<p>\u9493\u7684\u90fd\u662f\u5ec9\u4ef7\u9c7c\u5858\uff0c80\u5143\u8fd8\u670988\u5143\u7684\uff0c\u679c\u7136\u96be\u9493\u7684\u4e00\u584c\u7cca\u6d82\uff0c\u524d\u8005\u5c314\u6761\u9ca4\u9c7c\uff0c\u540e\u80054\u6761\u534a\u65a4\u9cab\u9c7c\u548c\u4e24\u6761\u592a\u9633\u9c7c\u3002<\/p>\n<p>\u6ca1\u529e\u6cd5\uff0c\u4f5c\u4e3a\u63a2\u9493\u535a\u4e3b\uff0c\u4e0d\u80fd\u6311\u5730\u65b9\uff0c\u597d\u4e0e\u4e0d\u597d\u90fd\u8981\u53bb\u3002<\/p>\n<p>\u4e0b\u534a\u5468\u5929\u5f88\u70ed\uff0c\u662f\u4e0d\u662f\u53ef\u4ee5\u627e\u4e2a\u51c9\u5feb\u7684\u5730\u65b9\u907f\u6691\u5462\uff1f<\/p>\n<p>?<\/p>\n<p>\u672c\u6587\u4e3a\u539f\u521b\u6587\u7ae0\uff0c\u4f1a\u7ecf\u5e38\u66f4\u65b0\u77e5\u8bc6\u70b9\u4ee5\u53ca\u4fee\u6b63\u4e00\u4e9b\u9519\u8bef\uff0c\u56e0\u6b64\u8f6c\u8f7d\u8bf7\u4fdd\u7559\u539f\u51fa\u5904\uff0c\u65b9\u4fbf\u6eaf\u6e90\uff0c\u907f\u514d\u9648\u65e7\u9519\u8bef\u77e5\u8bc6\u7684\u8bef\u5bfc\uff0c\u540c\u65f6\u6709\u66f4\u597d\u7684\u9605\u8bfb\u4f53\u9a8c\u3002<br \/>\n\u672c\u6587\u5730\u5740\uff1a<a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/?p=11293\">https:\/\/www.zhangxinxu.com\/wordpress\/?p=11293<\/a><\/p>\n<p>\uff08\u672c\u7bc7\u5b8c\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202407\/cover-fade.png\" width=\"160\" height=\"102\" alt=\"\u5c01\u9762\u5360\u4f4d\u56fe\" class=\"alignright size-medium\" loading=\"lazy\" \/><\/p>\n<p>\u672c\u6587\u901a\u8fc7\u6848\u4f8b\u6f14\u793a\u5982\u4f55\u4f7f\u7528\u5f00\u6e90JS\u5e93\u5b9e\u73b0\u97f3\u9891\u6de1\u5165\u6de1\u51fa\u3001\u539f\u751fJS\u53c8\u8be5\u5b9e\u73b0\uff0c\u4ee5\u53ca\u5982\u4f55\u4ece\u5e95\u5c42\u5bf9\u97f3\u9891\u8fdb\u884c\u6de1\u5165\u6de1\u51fa\u8f6c\u6362\uff0c\u90fd\u662f\u5c11\u89c1\u7684\u6280\u672f\u5206\u4eab\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[180],"tags":[489,1638,266,1945,1824,1392],"_links":{"self":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/11293"}],"collection":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/comments?post=11293"}],"version-history":[{"count":0,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/11293\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/media?parent=11293"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/categories?post=11293"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/tags?post=11293"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}