- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
目前 BigCommerce 具有这种隐藏/显示效果,一次只显示结帐过程的一个步骤。这是一个相当烦人的 Accordion 。我试图在页面上打开 Accordion 信息。另外,我很乐意合并和/或更改步骤顺序。任何这方面的帮助都会很棒!这是用于结帐过程的 JS 示例。
var ExpressCheckout = {
completedSteps: new Array(),
currentStep: 'AccountDetails',
signedIn: 0,
digitalOrder: 0,
createAccount: 0,
anonymousCheckout: 0,
checkoutLogin: 0,
init: function()
{
if($('#CheckoutStepAccountDetails').css('display') == 'none') {
ExpressCheckout.currentStep = 'BillingAddress';
}
else {
$('#BillingDetailsLabel').html(lang.ExpressCheckoutStepBillingAccountDetails);
}
$('.ExpressCheckoutBlock').hover(function() {
if($(this).hasClass('ExpressCheckoutBlockCompleted')) {
$(this).css('cursor', 'pointer');
}
},
function() {
$(this).css('cursor', 'default');
});
$('.ExpressCheckoutTitle').click(function() {
if($(this).hasClass('ExpressCheckoutBlockCompleted')) {
$(this).find('.ChangeLink').click();
}
});
// Capture any loading errors
$(document).ajaxError(function(event, request, settings) {
ExpressCheckout.HideLoadingIndicators();
alert(lang.ExpressCheckoutLoadError);
});
},
Login: function()
{
$('#CheckoutLoginError').hide();
ExpressCheckout.anonymousCheckout = 0;
ExpressCheckout.createAccount = 0;
if(ExpressCheckout.validateEmailAddress($('#login_email').val()) == false) {
alert(lang.LoginEnterValidEmail);
$('#login_email').focus();
$('#login_email').select();
return false;
}
if($('#login_pass').val() == '') {
alert(lang.LoginEnterPassword);
$('#login_pass').focus();
return false;
}
ExpressCheckout.ShowLoadingIndicator('#LoginForm');
$.ajax({
url: 'remote.php',
type: 'post',
dataType: 'json',
data: 'w=expressCheckoutLogin&'+$('#LoginForm').serialize(),
success: ExpressCheckout.HandleResponse
});
return false;
},
HandleResponse: function(response)
{
ExpressCheckout.HideLoadingIndicators();
if(response.completedSteps != undefined) {
$.each(response.completedSteps, function() {
var value = document.createTextNode(this.message);
$('#CheckoutStep'+this.id+' .ExpressCheckoutCompletedContent').html(value);
$('#CheckoutStep'+this.id).addClass('ExpressCheckoutBlockCompleted');
ExpressCheckout.completedSteps[ExpressCheckout.completedSteps.length] = this.id;
});
}
if(response.stepContent != undefined) {
$.each(response.stepContent, function() {
$('#CheckoutStep'+this.id+' .ExpressCheckoutContent').html(this.content);
$('#CheckoutStep'+this.id+' .ExpressCheckoutContent .FormField.JSHidden').show();
});
}
ExpressCheckout.HandleResponseStatus(response);
},
HandleResponseStatus: function(response)
{
if(response.status == 0) {
if(response.errorContainer) {
$(response.errorContainer).html(response.errorMessage).show();
}
else {
alert(response.errorMessage);
}
}
if(response.changeStep) {
ExpressCheckout.ChangeStep(response.changeStep);
ExpressCheckout.ResetNextSteps();
}
// Set focus to a particular field
if(response.focus) {
try {
$(response.focus).focus().select();
}
catch(e) { }
}
},
GuestCheckout: function()
{
$('#CreateAccountForm').show();
$('#CheckoutLoginError').hide();
if($('#CheckoutGuestForm').css('display') != 'none' && !$('#checkout_type_register:checked').val()) {
type = 'guest';
ExpressCheckout.anonymousCheckout = 1;
ExpressCheckout.createAccount = 0;
}
else {
type = 'account';
ExpressCheckout.anonymousCheckout = 0;
ExpressCheckout.createAccount = 1;
}
ExpressCheckout.ShowLoadingIndicator('#CheckoutGuestForm');
$.ajax({
url: 'remote.php',
type: 'post',
dataType: 'json',
data: {
w: 'expressCheckoutGetAddressFields',
type: type
},
success: ExpressCheckout.HandleResponse
});
},
ResetNextSteps:function()
{
steps = ExpressCheckout.GetSteps();
var beginReset = false;
var newCompleted = Array();
$.each(steps, function(i, step) {
if(step == ExpressCheckout.currentStep) {
newCompleted[newCompleted.length] = step;
beginReset = true;
}
else if(beginReset == true) {
$('#CheckoutStep'+step).removeClass('ExpressCheckoutBlockCompleted');
$('#CheckoutStep'+step+' .ExpressCheckoutCompletedContent').html('');
}
});
ExpressCheckout.completedSteps = newCompleted;
},
ChangeStep: function(step)
{
if(typeof(step) == 'undefined') {
step = ExpressCheckout.CalculateNextStep(ExpressCheckout.currentStep);
}
if(step == ExpressCheckout.currentStep) {
return false;
}
$('#CheckoutStep'+ExpressCheckout.currentStep+' .ExpressCheckoutContent').slideUp('slow');
$('#CheckoutStep'+ExpressCheckout.currentStep).addClass('ExpressCheckoutBlockCollapsed');
if($.inArray(ExpressCheckout.currentStep, ExpressCheckout.completedSteps) != -1) {
$('#CheckoutStep'+ExpressCheckout.currentStep).addClass('ExpressCheckoutBlockCompleted');
}
$('#CheckoutStep'+step+' .ExpressCheckoutContent').slideDown('slow');
$('#CheckoutStep'+step).removeClass('ExpressCheckoutBlockCollapsed');
ExpressCheckout.currentStep = step;
return false;
},
GetSteps: function()
{
var steps = Array();
if(ExpressCheckout.signedIn == 0) {
steps[steps.length] = 'AccountDetails';
}
steps[steps.length] = 'BillingAddress';
if(!ExpressCheckout.digitalOrder) {
steps[steps.length] = 'ShippingAddress';
steps[steps.length] = 'ShippingProvider';
}
steps[steps.length] = 'Confirmation';
steps[steps.length] = 'PaymentDetails';
return steps;
},
CalculateNextStep: function(currentStep) {
steps = ExpressCheckout.GetSteps();
var nextStep = '';
$.each(steps, function(i, step) {
if(step == currentStep) {
nextStep = steps[i + 1];
}
});
if(nextStep) {
return nextStep;
}
},
ChooseBillingAddress: function()
{
// Chosen to use a new address?
if(!$('#BillingAddressTypeExisting:checked').val() || $('#ChooseBillingAddress').css('display') == 'none') {
// If creating a new account, validate the account fields as well
if((ExpressCheckout.anonymousCheckout || ExpressCheckout.createAccount) &&
!ExpressCheckout.ValidateNewAccount(true)) {
return false;
}
if(!ExpressCheckout.ValidateNewAddress('billing')) {
return false;
}
addressType = 'new';
}
// An address wasn't selected
else if($('.SelectBillingAddress select option:selected').val() == -1) {
alert(lang.ExpressCheckoutChooseBilling);
$('.SelectBillingAddress select').focus();
return false;
}
else {
addressType = 'existing';
}
createAppend = '';
if(ExpressCheckout.createAccount) {
createAppend = '&createAccount=1';
}
// ISC-1214: no script issue in webkit browser, with serialized form submission
$('noscript').remove();
$.ajax({
url: 'remote.php',
type: 'post',
dataType: 'json',
data: 'w=saveExpressCheckoutBillingAddress&'
+ $('#NewBillingAddress').serialize()
+ '&BillingAddressType=' + addressType
+ createAppend,
success: ExpressCheckout.HandleResponse
});
return false;
},
ChooseShippingAddress: function(copyBilling)
{
// Chosen to use a new address?
if(!$('#ShippingAddressTypeExisting:checked').val() || $('#ChooseShippingAddress').css('display') == 'none') {
if(!ExpressCheckout.ValidateNewAddress('shipping')) {
return false;
}
addressType = 'new';
}
// An address wasn't selected
else if($('.SelectShippingAddress select option:selected').val() == -1) {
alert(lang.ExpressCheckoutChooseShipping);
$('.SelectShippingAddress select').focus();
return false;
}
else {
addressType = 'existing';
}
$.ajax({
url: 'remote.php',
type: 'post',
dataType: 'json',
data: 'w=saveExpressCheckoutShippingAddress&'
+$('#NewShippingAddress').serialize()
+'&ShippingAddressType='+addressType,
success: ExpressCheckout.HandleResponse
});
return false;
},
SetBillingAndShippingAddress: function()
{
// billing address is pre-selected so update the HTML block content from selected index
billingAddress = $('.SelectBillingAddress select option:selected').html().substring(0, 58);
$('#CheckoutStepBillingAddress .ExpressCheckoutCompletedContent').html(billingAddress + '...');
$('#CheckoutStepBillingAddress').addClass('ExpressCheckoutBlockCompleted');
// select given shipping address and reset the cart step to ShippingProvider
ExpressCheckout.ChooseShippingAddress();
return false;
},
ChooseShippingProvider: function()
{
// A shipping provider hasn't been selected
var shippingValid = true;
$('#CheckoutStepShippingProvider .ShippingProviderList').each(function() {
if(!$(this).find('input[type=radio]:checked').val()) {
alert(lang.ExpressCheckoutChooseShipper);
$(this).find('input[type=radio]').get(0).focus();
shippingValid = false;
return false;
}
});
if(shippingValid == false) {
return false;
}
$.ajax({
url: 'remote.php',
type: 'post',
dataType: 'json',
data: 'w=saveExpressCheckoutShippingProvider&'+$('#CheckoutStepShippingProvider form').serialize(),
success: ExpressCheckout.HandleResponse
});
return false;
},
ShowLoadingIndicator: function(step) {
if(typeof(step) == 'undefined') {
step = 'body';
}
$(step).find('.ExpressCheckoutBlock input[type=submit]').each(function() {
$(this).attr('oldValue', $(this).val());
$(this).val(lang.ExpressCheckoutLoading);
$(this).attr('disabled', true);
});
$(step).find('.LoadingIndicator').show();
$('body').css('cursor', 'wait');
},
HideLoadingIndicators: function()
{
HideLoadingIndicator();
$('.ExpressCheckoutBlock input[type=submit]').each(function() {
if($(this).attr('oldValue') && $(this).attr('disabled') == true) {
$(this).val($(this).attr('oldValue'));
$(this).attr('disabled', false);
}
});
$('.LoadingIndicator').hide();
$('body').css('cursor', 'default');
},
LoadOrderConfirmation: function()
{
postVars.w = 'expressCheckoutShowConfirmation';
$.ajax({
url: 'remote.php',
type: 'post',
dataType: 'json',
data: postVars,
success: ExpressCheckout.HandleResponse
});
},
HidePaymentForm: function()
{
$('#CheckoutStepPaymentDetails').hide();
$('#CheckoutStepPaymentDetails .ExpressCheckoutContent').html('');
},
LoadPaymentForm: function(provider)
{
$.ajax({
url: 'remote.php',
data: 'w=expressCheckoutLoadPaymentForm&'+$('#CheckoutStepConfirmation form').serialize(),
dataType: 'json',
type: 'post',
success: ExpressCheckout.HandleResponse
});
},
ShowSingleMethodPaymentForm: function()
{
$('#CheckoutStepPaymentDetails').show();
ShowContinueButton();
},
ValidateNewAccount: function()
{
var password, confirmPassword, formfield = FormField.GetValues(CustomCheckoutFormNewAccount);
for (var i=0; i<formfield.length; i++) {
// Check email
if (formfield[i].privateId == 'EmailAddress') {
if (ExpressCheckout.validateEmailAddress(formfield[i].value) == false) {
alert(lang.LoginEnterValidEmail);
FormField.Focus(formfield[i].field);
return false;
}
}
if (formfield[i].privateId == 'Password') {
if(!ExpressCheckout.createAccount) {
continue;
}
password = formfield[i];
}
else if(formfield[i].privateId == 'ConfirmPassword') {
if(!ExpressCheckout.createAccount) {
continue;
}
confirmPassword = formfield[i];
}
var rtn = FormField.Validate(formfield[i].field);
if (!rtn.status) {
alert(rtn.msg);
FormField.Focus(formfield[i].field);
return false;
}
}
// Compare the passwords
if (ExpressCheckout.createAccount && password && password.value !== confirmPassword.value) {
alert(lang.AccountPasswordsDontMatch);
FormField.Focus(confirmPassword.field);
return false;
}
return true;
},
BuildAddressLine: function(type)
{
var fieldList = {
'FirstName' : '',
'LastName' : '',
'Company' : '',
'AddressLine1' : '',
'City' : '',
'State' : '',
'Zip' : '',
'Country' : ''
};
if(type == 'billing') {
var formId = CustomCheckoutFormBillingAddress;
}
else {
var formId = CustomCheckoutFormShippingAddress;
}
var formfields = FormField.GetValues(formId);
var addressLine = '';
for (var i=0; i<formfields.length; i++) {
fieldList[formfields[i].privateId] = formfields[i].value;
}
for (var i in fieldList) {
var val = fieldList[i];
if (val !== '') {
if(addressLine != '' && i != 'LastName') {
addressLine += ', ';
} else if(i == 'LastName') {
addressLine += ' ';
}
addressLine += val;
}
};
return addressLine;
},
ValidateNewAddress: function(lowerType, resultOnly)
{
if (resultOnly !== true) {
resultOnly = false;
}
if(lowerType == 'billing') {
var formId = CustomCheckoutFormBillingAddress;
} else {
var formId = CustomCheckoutFormShippingAddress;
}
var formfields = FormField.GetValues(formId);
var hasErrors = false;
for (var i=0; i<formfields.length; i++) {
var rtn = FormField.Validate(formfields[i].field);
if (!rtn.status) {
if (!resultOnly) {
alert(rtn.msg);
}
FormField.Focus(formfields[i].field);
hasErrors = true;
return false;
}
}
if(hasErrors == true) {
return false;
}
else {
return true;
}
},
validateEmailAddress: function(email)
{
if(email.indexOf('@') == -1 || email.indexOf('.') == -1) {
return false;
}
return true;
},
ToggleAddressType: function(address, type)
{
if(type == 'Select') {
$('.Select'+address+'Address').show();
$('.Add'+address+'Address').hide();
}
else {
$('.Add'+address+'Address').show();
$('.Select'+address+'Address').hide();
}
},
SelectedPaymentProvider: function() {
var paymentProvider = '';
// Get the ID of the selected payment provider
if($('#use_store_credit').css('display') != "none") {
if($('#store_credit:checked').val()) {
if($('#credit_provider_list').css('display') != "none") {
paymentProvider = $('#credit_provider_list input:checked');
}
}
else {
paymentProvider = $('#provider_list input:checked');
}
}
else {
paymentProvider = $('#provider_list input:checked');
}
return paymentProvider
},
ConfirmPaymentProvider: function()
{
//if terms and conditions is enabled and the customer didn't tick agree terms and conditions
if($('.CheckoutHideOrderTermsAndConditions').css('display') != "none" && $('#AgreeTermsAndConditions').prop('checked') != true){
alert(lang.TickArgeeTermsAndConditions);
return false;
}
if(!confirm_payment_provider()) {
return false;
}
var paymentProvider = ExpressCheckout.SelectedPaymentProvider();
if(paymentProvider != '' && $(paymentProvider).hasClass('ProviderHasPaymentForm')) {
var providerName = $('.ProviderName'+paymentProvider.val()).html();
$('#CheckoutStepConfirmation .ExpressCheckoutCompletedContent').html(providerName);
ExpressCheckout.LoadPaymentForm($(paymentProvider).val());
return false;
}
else {
ExpressCheckout.HidePaymentForm();
return true;
}
},
ApplyCouponCode: function()
{
if($('#couponcode').val() == '') {
alert(lang.EnterCouponCode);
$('#couponcode').focus();
return false;
}
// Reload the order confirmation
$.ajax({
url: 'remote.php',
data: 'w=getExpressCheckoutConfirmation&'+$('#CheckoutStepConfirmation form').serialize(),
dataType: 'json',
type: 'post',
success: ExpressCheckout.HandleResponse
});
return false;
},
UncheckPaymentProvider: function()
{
$('#provider_list input').each(function() {
$(this).attr('checked', false);
});
}
};
最佳答案
我可以同时打开顶部的三个 Accordion (底部的是运输方式和订单确认,我认为这与前面的步骤有关)
$('.ExpressCheckoutBlockCollapsed').addClass('ExpressCheckoutBlockCompleted')
$('.ExpressCheckoutBlockCollapsed').removeClass('ExpressCheckoutBlockCollapsed')
我想如果您在结帐页面上有此代码触发器,它可能会有所帮助。关于更改元素的顺序,chrome 控制台显示与这些元素关联的以下 ID,您不能根据需要将它们锚定到不同的位置吗?
$('.ExpressCheckoutBlockCollapsed').addClass('ExpressCheckoutBlockCompleted')
[
<div class="Clear ExpressCheckoutBlock ExpressCheckoutBlockCompleted" id="CheckoutStepBillingAddress" style="cursor: default;">…</div>
,
<div class="Clear ExpressCheckoutBlock ExpressCheckoutBlockCollapsed ExpressCheckoutBlockCompleted" id="CheckoutStepShippingAddress" style>…</div>
,
<div class="Clear ExpressCheckoutBlock ExpressCheckoutBlockCollapsed ExpressCheckoutBlockCompleted" id="CheckoutStepShippingProvider" style>…</div>
,
<div class="Clear ExpressCheckoutBlock ExpressCheckoutBlockCollapsed ExpressCheckoutBlockCompleted" id="CheckoutStepConfirmation">…</div>
,
<div class="Clear ExpressCheckoutBlock ExpressCheckoutBlockCollapsed ExpressCheckoutBlockCompleted" id="CheckoutStepPaymentDetails" style="display: none">…</div>
]
关于javascript - BigCommerce 上的 TRUE 单一结帐页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18322878/
这个问题在这里已经有了答案: Why in Python does "0, 0 == (0, 0)" equal "(0, False)"? (7 个回答) 去年关闭。 代码片段 1: a = Tru
Integer i = 127; Integer j = 127; System.out.println(i == j); System.out.println(i.equals(j)); Integ
我试图用 Python 进行类似下面的代码的比较,但对产生的输出感到困惑。 谁能解释为什么输出是这样的? >>> True, True == True, True (True, True, True)
我们的下拉值是动态的 010100。 你能帮我将这些值转换为 true、false 吗? Offer的值是10100,Reject的值是10111。所以这些需要转换成 10100 = true,fal
我正在测试,如果用户在页面顶部显示一种货币“EUR”和另一种货币“GBP”,那么我期望包含文本“EUR”和页面下方还存在另一个包含文本“GBP”的链接。它包含在一个名为 "nav-tabs au-ta
如何检查数组的所有元素是真值还是假值。 因为以下内容似乎没有做到这一点:_.all([true, true, true], true); 它返回:false? 最佳答案 您应该重新阅读_.every(
C#:我有一个如下所示的字符串变量: string a = "(true and true) or (true or false)"; 这可以是任何东西,它可以变得更复杂,比如: string b
ruby : true == true == true syntax error, unexpected tEQ 对比JavaScript: true == true == true // => tr
这个问题已经有答案了: Equality of truthy and falsy values (JavaScript) (3 个回答) Which equals operator (== vs ==
为什么 R 中的 TRUE == "TRUE" 是 TRUE? R 中是否有与 === 等效的内容? 更新: 这些都返回FALSE: TRUE == "True" TRUE == "true" TRU
简单的查询,可能不可能,但我知道那里有一些聪明的人:) 给定一个 bool 参数,我希望定义我的 where 子句来限制特定列的输出 - 或不执行任何操作。 因此,给定参数@bit = 1,结果将是:
编写 Excel 公式时,将值设置为 true、“true”还是 true() 是否有区别? 换句话来说,以下哪一个是最好的?还是要看具体情况? if (A1 = 1, true, false) if
如果我们评估这个:TRUE AND TRUE,为什么会这样? 'yes' : 'no' 等于 TRUE 但不等于 yes 何时评估:(TRUE AND TRUE) ? 'yes' : 'no' 等于
这个问题在这里已经有了答案: Behaviour of and operator in javascript [duplicate] (1 个回答) 关闭 7 年前。 如题所说,我不太明白为什么(t
我有一个包含 FromDate 、 ToDate 、 VendorName 和 GoodsName 的表单,一旦一切为真,我需要显示结果 示例: FromDate="11/20/2019"、ToDat
我最近参加了 Java 的入门测试,这个问题让我很困惑。完整的问题是: boolean b1 = true; boolean b2 = false; if (b2 != b1 != b2) S
我有一个模型,我有: ipv4_address = models.IPAddressField(verbose_name=_('ipv4 address'), blank=True, null=Tru
False in [True,True] False in pd.Series([True,True]) 第一行代码返回False第二行代码返回 True! 我想我一定是做错了什么或者遗漏了什么。当我
我可以在 Coq 中证明以下内容吗? Lemma bool_uip (H1 : true = true): H1 = eq_refl true. 即true = true 的所有证明都相同吗? 例如
如果我的理解是正确的,他们做的事情完全一样。为什么有人会使用“for”变体?仅仅是味道吗? 编辑:我想我也在考虑 for (;;)。 最佳答案 for (;;) 通常用于防止编译器警告: while(
我是一名优秀的程序员,十分优秀!