This commit is contained in:
@@ -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();
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user