gpt4 book ai didi

javascript - 使用 smoothstate.js 提交表单会导致 smoothstate 触发

转载 作者:行者123 更新时间:2023-12-01 03:57:17 25 4
gpt4 key购买 nike

我的网站在每个页面上都使用 smoothstate.js。在几页上,我弹出一个带有表单的模式框。这些表格工作得很好。

在另一个页面上,我有一个包含在 html 中的基本表单。当我单击表单上的提交按钮时,表单实际上已提交,但 smoothstate 启动,淡出内容并启动加载屏幕。

我希望这种事不要发生。这是我的 smoothstate 函数:

$(function(){
'use strict';
var $page = $('#main'),
options = {
debug: true,
prefetch: true,
cacheLength: 2,
allowFormCaching: false,
forms: 'form',
blacklist: 'input[type="submit"], .animsition-loading, .hs-button',
onStart: {
duration: 1050, // Duration of our animation
render: function ($container) {
$('.animsition-loading').show();
$container.addClass( 'slide-out' );
smoothState.restartCSSAnimations();
}
},
onReady: {
duration: 0,
render: function ($container, $newContent) {
$container.html($newContent);
sitejs();
$(document).ready();
$(window).trigger('load');
}
},
onAfter: function( $container ) {
$('.animsition-loading').hide();
$container.removeClass( 'slide-out' );
}
},
smoothState = $page.smoothState(options).data('smoothState');
});

最佳答案

我在使用时事通讯表单时也遇到了同样的问题。这是您问题的解决方案。您必须将 JS 中的黑名单类(例如“no-smoothsate”)添加到 FORM 标记中。它运行完美。

<form class="no-smoothState">
...
</form>

我找到了解决方案here

关于javascript - 使用 smoothstate.js 提交表单会导致 smoothstate 触发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42537764/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com