diff --git a/common/common.css b/common/common.css index a184773..bc1752b 100644 --- a/common/common.css +++ b/common/common.css @@ -967,6 +967,27 @@ } +/* 回到顶部按钮特殊样式 */ +.aside-tools .tools-list .tools-item.back-top { + cursor: pointer; + background: rgba(56, 189, 248, 0.15); + transition: all 0.3s ease; +} + +.aside-tools .tools-list .tools-item.back-top:hover { + background: linear-gradient(135deg, #38BDF8 0%, #6366F1 100%); + box-shadow: 0 4px 16px rgba(56, 189, 248, 0.4); +} + +.aside-tools .tools-list .tools-item.back-top img { + transition: transform 0.3s ease; +} + +.aside-tools .tools-list .tools-item.back-top:hover img { + transform: translateY(-3px); +} + + .flex-none { flex-wrap: none !important; } diff --git a/common/common.js b/common/common.js index 7dc7883..48eec4b 100644 --- a/common/common.js +++ b/common/common.js @@ -105,21 +105,21 @@ $(function () { $(".login-in").attr("style", "display:none"); $(".no-login").attr("style", "display:block"); } - }; - // 设置通用信息相关的点击跳转(云服务器/物理机 CTA 等),来源于 SSR 注入的 window.__themeCommon - const setCommData = () => { - const commentObj = window.__themeCommon || {}; - $(".buy-cloud").click(function () { - if (commentObj.cloud_product_link) { - location.href = commentObj.cloud_product_link; - } - }); - $(".buy-dcim-btn").click(function () { - if (commentObj.dcim_product_link) { - location.href = commentObj.dcim_product_link; - } - }); - }; + }; + // 设置通用信息相关的点击跳转(云服务器/物理机 CTA 等),来源于 SSR 注入的 window.__themeCommon + const setCommData = () => { + const commentObj = window.__themeCommon || {}; + $(".buy-cloud").click(function () { + if (commentObj.cloud_product_link) { + location.href = commentObj.cloud_product_link; + } + }); + $(".buy-dcim-btn").click(function () { + if (commentObj.dcim_product_link) { + location.href = commentObj.dcim_product_link; + } + }); + }; // 跳转函数 const goOtherPage = (url) => { sessionStorage.redirectUrl = location.href; @@ -221,11 +221,11 @@ $(function () { $("#shopping-cart").click(function () { location.href = "/cart/shoppingCar.htm"; }); - } - function initFooter() { - // 主题配置已在服务端渲染阶段注入到 window.__themeCommon,这里只做少量点击事件绑定 - setCommData(); - } + } + function initFooter() { + // 主题配置已在服务端渲染阶段注入到 window.__themeCommon,这里只做少量点击事件绑定 + setCommData(); + } // 首页渲染 // $("#header").load("/web/BlackFruit-web/public/header.html", function () { // initHeader(); @@ -237,26 +237,26 @@ $(function () { // }); initFooter(); - const resize = function () { - const width = $(window).width(); - const num = width / 1400; - if (1000 < width && width < 1440) { - // 为了避免首页 3D 粒子地球被横向压扁,这里不再对首页 banner 区域做 scaleX,仅对其他 section 生效 - $("section") - .not(".banner") - .each(function () { - this.style.width = "1400px"; - this.style.transform = "scaleX(" + num + ")"; - this.style.transformOrigin = "0 0"; - }); - } else { - $("section").each(function () { - this.style.width = ""; - this.style.transform = ""; - this.style.transformOrigin = ""; - }); - } - }; + const resize = function () { + const width = $(window).width(); + const num = width / 1400; + if (1000 < width && width < 1440) { + // 为了避免首页 3D 粒子地球被横向压扁,这里不再对首页 banner 区域做 scaleX,仅对其他 section 生效 + $("section") + .not(".banner") + .each(function () { + this.style.width = "1400px"; + this.style.transform = "scaleX(" + num + ")"; + this.style.transformOrigin = "0 0"; + }); + } else { + $("section").each(function () { + this.style.width = ""; + this.style.transform = ""; + this.style.transformOrigin = ""; + }); + } + }; resize(); window.addEventListener("resize", resize); @@ -314,4 +314,23 @@ $(function () { $(".go-ticket-btn").click(function () { location.href = "home.htm"; }); + + // 回到顶部功能 + $("#backTop").click(function () { + $("html, body").animate({ scrollTop: 0 }, 600); + }); + + // 根据滚动位置显示/隐藏回到顶部按钮 + $(window).scroll(function () { + if ($(this).scrollTop() > 300) { + $("#backTop").fadeIn(); + } else { + $("#backTop").fadeOut(); + } + }); + + // 初始化时隐藏回到顶部按钮 + if ($(window).scrollTop() <= 300) { + $("#backTop").hide(); + } }); diff --git a/css/index.css b/css/index.css index 36df0f6..6c1e578 100644 --- a/css/index.css +++ b/css/index.css @@ -144,8 +144,8 @@ justify-content: center !important; gap: 8px !important; padding: 0 48px !important; - font-size: 14px !important; - font-weight: 500 !important; + font-size: 16px !important; + font-weight: 600 !important; color: #ffffff !important; background: linear-gradient(135deg, #38BDF8 0%, #6366F1 100%) !important; border: none !important; @@ -159,6 +159,7 @@ min-width: 140px !important; flex-shrink: 0 !important; box-shadow: none !important; + z-index: 1 !important; } /* 注册按钮图标 */ @@ -172,7 +173,7 @@ background-repeat: no-repeat; background-position: center; position: relative; - z-index: 2; + z-index: 3; flex-shrink: 0; } @@ -188,7 +189,7 @@ opacity: 0; transition: opacity 0.3s ease; pointer-events: none; - z-index: 1; + z-index: 0; } #index .no-login .btn.btn-normal#registBtn:hover { diff --git a/public/header.html b/public/header.html index 60f1936..5fbbc81 100644 --- a/public/header.html +++ b/public/header.html @@ -95,6 +95,11 @@
+ +
+ 回到顶部 +
+ {if ( isset($data.side_floating_window) ) } {foreach $data.side_floating_window as $key=>$value}