3,389
个编辑
MCBBS Wiki欢迎您共同参与编辑!在参与编辑之前请先阅读Wiki方针。
如果在编辑的过程中遇到了什么问题,可以去讨论板提问。
为了您能够无阻碍地参与编辑 未验证/绑定过邮箱的用户,请尽快绑定/验证。
MCBBS Wiki GitHub群组已上线!
您可以在回声洞中发表吐槽!
服务器状态监控。点击进入
本站由MCBBS用户自行搭建,与MCBBS及东银河系漫游指南(北京)科技有限公司没有从属关系。点此了解 MCBBS Wiki 不是什么>>
Salt lovely(留言 | 贡献) 小 (// Edit via Wikiplus) |
Salt lovely(留言 | 贡献) 小 (// Edit via Wikiplus) |
||
| 第63行: | 第63行: | ||
let yesBtn = document.createElement('div') | let yesBtn = document.createElement('div') | ||
yesBtn.className = 'btn' | yesBtn.className = 'btn' | ||
yesBtn.style.setProperty('--hover-color', '# | yesBtn.style.setProperty('--hover-color', '#FDF6E6') | ||
yesBtn.textContent = '确定' | yesBtn.textContent = '确定' | ||
yesBtn.addEventListener('click', () => { | yesBtn.addEventListener('click', () => { | ||
| 第76行: | 第76行: | ||
let noBtn = document.createElement('div') | let noBtn = document.createElement('div') | ||
noBtn.className = 'btn' | noBtn.className = 'btn' | ||
noBtn.style.setProperty('--hover-color', '# | noBtn.style.setProperty('--hover-color', '#FDF6E6') | ||
noBtn.textContent = '取消' | noBtn.textContent = '取消' | ||
noBtn.addEventListener('click', () => { | noBtn.addEventListener('click', () => { | ||
| 第86行: | 第86行: | ||
}) | }) | ||
container.appendChild(noBtn) | container.appendChild(noBtn) | ||
// 关闭按钮 | |||
let closeBtn = document.createElement('div') | |||
closeBtn.className = 'close' | |||
closeBtn.textContent = '×' | |||
closeBtn.addEventListener('click', () => { | |||
if (safe) { | |||
safe = false | |||
selfRemove() | |||
} | |||
}) | |||
container.appendChild(closeBtn) | |||
// 显示UI | // 显示UI | ||
container.style.opacity = '0' | container.style.opacity = '0' | ||
container.style.top = '- | container.style.top = '20%' | ||
container.style.transitionTimingFunction = 'ease-out' | |||
document.body.appendChild(container) | document.body.appendChild(container) | ||
// 调整位置 | // 调整位置 | ||
container.style.marginLeft = (container.offsetWidth * -0.5) + 'px' | container.style.marginLeft = (container.offsetWidth * -0.5) + 'px' | ||
container.style.marginTop = (container.offsetHeight * -0.5) + 'px' | container.style.marginTop = (container.offsetHeight * -0.5) + 'px' | ||
container.style.transitionDuration = '.3s' | |||
container.style.opacity = '1' | container.style.opacity = '1' | ||
container.style.top = '50%' | container.style.top = '50%' | ||
setTimeout(() => { container.style.transitionTimingFunction = 'ease-in' }, 500) | |||
/**移除自己 */ | /**移除自己 */ | ||
function selfRemove() { | function selfRemove() { | ||
container.style.top = ' | container.style.top = '20%' | ||
container.style.opacity = '1' | container.style.opacity = '1' | ||
setTimeout(() => { container.remove() }, 500) | setTimeout(() => { container.remove() }, 500) | ||
| 第116行: | 第128行: | ||
left: 50%; | left: 50%; | ||
min-width: 20vw; | min-width: 20vw; | ||
background: # | background: #fbf2dc; | ||
user-select: none; | user-select: none; | ||
} | } | ||
.confirmUIcontainer > center{ | .confirmUIcontainer > center{ | ||
| 第139行: | 第150行: | ||
.confirmUIcontainer .btn:hover{ | .confirmUIcontainer .btn:hover{ | ||
background-color: var(--hover-color,transparent); | background-color: var(--hover-color,transparent); | ||
} | |||
.confirmUIcontainer .close{ | |||
position: absolute; | |||
width: 2rem; | |||
height: 2rem; | |||
top: 0; | |||
right: 0; | |||
font-size: 2rem; | |||
line-height: 2rem; | |||
text-align: center; | |||
} | } | ||
` | ` | ||
document.head.appendChild(s) | document.head.appendChild(s) | ||
}) | }) | ||