简体   繁体   English

在结帐部分使用切换功能时,它们会向上折叠然后向下折叠。 应该只折叠一次

[英]When using toggle on my checkout sections, they fold up then fold back down. Should only fold up once

When using toggle on my checkout sections, they fold up then fold back down. 在结帐部分使用切换功能时,它们会向上折叠然后向下折叠。 Should only fold up once. 应该只折叠一次。

I've made a test case in jsfiddle: (not done with styling, so dont worry!) http://jsfiddle.net/Wd8Ty/ 我在jsfiddle中做了一个测试用例:(未完成样式设置,所以不用担心!) http://jsfiddle.net/Wd8Ty/

The code that does it, I believe, is from AMLRWDCustom.js: 我相信执行此操作的代码来自AMLRWDCustom.js:

$('.checkoutsteptitle').addClass('down').next('.checkoutstep').fadeIn()
$('.checkoutsteptitle').on('click', function () {
    $("select, input:checkbox, input:radio, input:file").css('display', 'block');
    $(this).toggleClass('down').next('.checkoutstep').slideToggle()
});

I just need it to fold up once, then fold down again if clicked. 我只需要将其折叠一次,然后单击即可再次折叠。 That's all. 就这样。 Any ideas? 有任何想法吗?

I found the answer. 我找到了答案。

Two of my JS files had the slideToggle() JS that I posted above. 我的两个JS文件具有我上面发布的slideToggle()JS。 I had mistakenly copied it. 我错误地复制了它。 Thus, it was firing twice. 因此,它开火了两次。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM