:root {
--primary-color: #3a86ff;
--secondary-color: #8338ec;}.header {
background: linear-gradient(to right, var(--primary-color), var(--secondary-color));}
document.querySelector('.btn').addEventListener('click', (e) => {
e.target.style.transform = 'scale(0.95)';
setTimeout(() => { e.target.style.transform = ''; }, 300);});
<img data-src="image.webp" class="lazyload" alt="示例"><script>
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.src = entry.target.dataset.src;
observer.unobserve(entry.target);
}
});
});
document.querySelectorAll('.lazyload').forEach(img => observer.observe(img));</script>
// 版本A:红色按钮// 版本B:蓝色按钮// 通过URL参数分配版本const version = new URLSearchParams(window.location.search).get('ab') === 'b' ? 'B' : 'A';document.body.classList.add(`version-${version.toLowerCase()}`);