6,571
次編輯
(// Edit via Wikiplus) |
無編輯摘要 |
||
第1行: | 第1行: | ||
$(function () { | $(function () { | ||
document.querySelector("#chart-constant-js-cut-in-1-box").style.display = "unset"; | |||
const container = document.getElementById("chart-constant-js-cut-in-1"); | const container = document.getElementById("chart-constant-js-cut-in-1"); | ||
第112行: | 第113行: | ||
$(function () { | $(function () { | ||
document.querySelector("#chart-constant-js-cut-in-1-box").style.display = "unset"; | |||
const container = document.getElementById("chart-constant-js-cut-in-2"); | |||
// 插入 HTML | |||
const htmlContent = ` | |||
<div class="button-container"> | <div class="button-container"> | ||
<button class="button single-toggle-button" data-color="#FF9500"> | <button class="button single-toggle-button" data-color="#FF9500"> | ||
第123行: | 第125行: | ||
`; | `; | ||
// 插入 CSS | |||
const cssContent = ` | |||
.button-container { | .button-container { | ||
display: flex; | display: flex; | ||
第158行: | 第160行: | ||
`; | `; | ||
// 插入 JS | |||
const jsContent = ` | |||
const button = document.querySelector(".single-toggle-button"); | const button = document.querySelector(".single-toggle-button"); | ||
const targets = document.querySelectorAll(".chart-constant-single-part-b"); | const targets = document.querySelectorAll(".chart-constant-single-part-b"); | ||
第189行: | 第191行: | ||
`; | `; | ||
container.innerHTML = htmlContent; | |||
const styleElement = document.createElement("style"); | |||
styleElement.innerHTML = cssContent; | |||
document.head.appendChild(styleElement); | |||
const scriptElement = document.createElement("script"); | |||
scriptElement.innerHTML = jsContent; | |||
document.body.appendChild(scriptElement); | |||
}); | }); |