ID 更改时关闭模态框
我正在使用 Eric Martin 的 SimpleModal (http://www.ericmmartin.com/projects/simplemodal-demos/),网址为 www.1tryten.com/checkout.php。加载代码很简单:
jQuery(function ($) {
$('#CheckoutStepAccountDetails').modal();
});
这将加载一个具有 2 个提交选项的表单,提交表单后,类 .ExpressCheckoutBlockCompleted 将添加到 div#CheckoutStepAccountDetails 中。这时候我需要让Modal消失。我尝试将 simplemodal-close 类添加到提交按钮,但随后它只是关闭模式而不提交表单。有谁知道我怎样才能做到这一点?
I'm using the SimpleModal by Eric Martin (http://www.ericmmartin.com/projects/simplemodal-demos/) at www.1tryten.com/checkout.php. The code for loading is simply:
jQuery(function ($) {
$('#CheckoutStepAccountDetails').modal();
});
This loads a form with 2 submit options, once the form has been submitted the class .ExpressCheckoutBlockCompleted is added to the div#CheckoutStepAccountDetails. At this time I need the Modal to disappear. I've tried adding the simplemodal-close class to the submit button, but then it simply closes the modal without submitting the form. Does anyone know how I could make this work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
本,
我怀疑仅仅在你的 div 中添加一个类就会让你消失模式。
我不使用该插件,但我使用自己的自定义代码来实现我的简单模式。
这就是我控制何时以及如何控制模式关闭的方式:
因此,对于您的情况,您需要在提交表单后添加此类调用
如果提交表单时有可用的回调函数,则可以添加代码以隐藏该回调函数内的模式。
希望这有帮助。
Ben,
I doubdt that just adding a class to your div will let you disappear the modal.
I don't use that plugin but I use own custom code for my simple modal.
This is how I control when and how to control the modal to close:
So for your case you need to add this type of call once the form is submitted
If you have a callback function available upon the form is submitted, you can add the code to hide the modal inside that call back function.
Hope this helps.
为了澄清,与 Projapati 所说的相反,向模态内的元素添加一个
simplemodal-close
类实际上会导致对话框在单击时关闭。根据您提供的内容,您需要做的就是以下内容:
抱歉,我无法早些时候回复此问题,我正在度假;)
For clarification, contrary to what Projapati said, adding a class of
simplemodal-close
to an element inside the modal will, in fact, cause the dialog to close when clicked.Based on what you've provided, all you should need to do is the following:
Sorry I wasn't able to respond to this earlier, I was on vacation ;)