这是我的变量页面,当我点击 #next 按钮时它会发生变化,当我执行console.log
时它已成功完成
$(document).ready(function (event) {
alert();
var page = "blank";
$(".billing-information").css("display", "none");
$(".services-information").css("display", "none");
$("#next").click(function () {
page = "services";
console.log(page);
$(".personal-information").css("display", "none");
$(".services-information").css("display", "block");
nextFromPersonalInformationCss();
})
$(".back-from-billing").click(function () {
page = "services"
console.log(page);
$(".services-information").css("display", "block");
$(".billing-information").css("display", "none");
backFromBillingCss();
})
$(".back-from-service").click(function () {
page = "personal-ionformation";
console.log(page);
$(".personal-information").css("display", "block");
$(".services-information").css("display", "none");
backFromServicesCss();
})
$(".next-from-service").click(function () {
page = "billing"
console.log(page);
$(".services-information").css("display", "none");
$(".billing-information").css("display", "block");
nextFromServicesCss();
})
现在我的问题是,当我改变屏幕尺寸时,它总是会给我"个人信息"值意味着屏幕尺寸的变化不能保持稳定
$(window).resize(function () {
var width = $(window).width();
// alert(width);
if (width <= 767) {
console.log(page);
if (page = "personal-ionformation") {
// alert("p")
$(".personal-detail").css("display", "block");
$(".services").css("display", "none");
$(".billing").css("display", "none");
}
else if (page == "services") {
答案 0 :(得分:0)
在if (page = "personal-ionformation")
中,
您正在执行作业,该作业将返回true
,并将其更改为if (page == "personal-ionformation")
。它可能有用。