|
@@ -1,17 +1,6 @@
|
|
|
// main.js - 前端增强脚本
|
|
// main.js - 前端增强脚本
|
|
|
|
|
|
|
|
document.addEventListener("DOMContentLoaded", function () {
|
|
document.addEventListener("DOMContentLoaded", function () {
|
|
|
- // 卡片悬停效果(桌面端)
|
|
|
|
|
- const cards = document.querySelectorAll(".card");
|
|
|
|
|
- cards.forEach((card) => {
|
|
|
|
|
- card.addEventListener("mouseenter", function () {
|
|
|
|
|
- this.style.transform = "translateY(-4px)";
|
|
|
|
|
- });
|
|
|
|
|
- card.addEventListener("mouseleave", function () {
|
|
|
|
|
- this.style.transform = "translateY(0)";
|
|
|
|
|
- });
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
// 图片懒加载(浏览器原生支持,这里作为后备)
|
|
// 图片懒加载(浏览器原生支持,这里作为后备)
|
|
|
if ("loading" in HTMLImageElement.prototype) {
|
|
if ("loading" in HTMLImageElement.prototype) {
|
|
|
const images = document.querySelectorAll('img[loading="lazy"]');
|
|
const images = document.querySelectorAll('img[loading="lazy"]');
|