-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
45 lines (40 loc) · 1.59 KB
/
script.js
File metadata and controls
45 lines (40 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
document.addEventListener('DOMContentLoaded', function() {
const backToTopButton = document.getElementById('backToTop');
window.addEventListener('scroll', function() {
if (window.pageYOffset > 300) {
backToTopButton.style.opacity = '1';
} else {
backToTopButton.style.opacity = '0';
}
});
backToTopButton.addEventListener('click', function() {
window.scrollTo({
top: 0,
behavior: 'smooth'
});
});
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function(e) {
e.preventDefault();
const target = document.querySelector(this.getAttribute('href'));
if (target) {
target.scrollIntoView({
behavior: 'smooth'
});
}
});
});
});
const ipText = document.getElementById('ip-text');
const copyIpButton = document.getElementById('copy-ip');
copyIpButton.addEventListener('click', function() {
const ip = ipText.textContent;
const input = document.createElement('input');
input.value = ip;
document.body.appendChild(input);
input.select();
document.execCommand('copy');
document.body.removeChild(input);
alert('服务器地址已复制到粘贴板!');
});
tailwind.config = { theme: { extend: { colors: { primary: '#007AFF', secondary: '#5856D6' }, borderRadius: { 'none': '0px', 'sm': '2px', DEFAULT: '4px', 'md': '8px', 'lg': '12px', 'xl': '16px', '2xl': '20px', '3xl': '24px', 'full': '9999px', 'button': '4px' } } } }