打开/关闭菜单
打开/关闭外观设置菜单
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。

用户:Xp00000000/Sandbox:修订间差异

来自Rizline中文维基
Xp00000000留言 | 贡献
无编辑摘要
Xp00000000留言 | 贡献
无编辑摘要
第2行: 第2行:
<style>
<style>
.normal-style {
.normal-style {
     padding: 10px;
     touch-action: manipulation; /* 减少移动端延迟 */
     background: #eee;
     -webkit-tap-highlight-color: transparent; /* 移除点击高亮 */
    cursor: pointer;
    margin: 10px 0;
    border-radius: 4px;
    transition: background 0.3s;
}
.clicked-style {
    background: #ccc;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.3);
}
}
</style>
</style>
第20行: 第12行:
     // 更新文本内容
     // 更新文本内容
     element.textContent = element.classList.contains("clicked-style")  
     element.textContent = element.classList.contains("clicked-style")  
         ? "已选中 (点击取消)"  
         ? "{{Diff|HD|10}}"  
         : "点击选择";
         : "{{Diff|IN|14}}";
     // 存储状态
     // 存储状态
     localStorage.setItem('boxState', element.classList.contains("clicked-style"));
     localStorage.setItem('boxState', element.classList.contains("clicked-style"));
第32行: 第24行:
         box.classList.toggle("clicked-style", isClicked);
         box.classList.toggle("clicked-style", isClicked);
         box.textContent = isClicked  
         box.textContent = isClicked  
             ? "已选中 (点击取消)"  
             ? "{{Diff|HD|10}}"  
             : "点击选择";
             : "{{Diff|IN|14}}";
     }
     }
};
};
第39行: 第31行:


<div id="myInteractiveBox" class="normal-style" onclick="toggleColor(this)">
<div id="myInteractiveBox" class="normal-style" onclick="toggleColor(this)">
点击选择
{{Diff|IN|14}}
</div>
</div>
</html>
</html>

2025年7月1日 (二) 20:47的版本

{{Diff|IN|14}}