繁体   English   中英

关闭当前的div并打开另一个

[英]close current div and open another

我感觉很小时。 我不能告诉我我的脚本,当我按下一个按钮时必须先关闭显示器,然后再打开新的显示器,有人帮我吗?

$(document).ready(function() {
    $('.testoprodotto').addClass("hidden");

    $('.testoprodotto').on('click', function() {
        if ($(this).hasClass("hidden")) {
            $(this).removeClass("hidden").addClass("visible"); // Dropdown
            $(this).find('.more').hide().siblings('.less').show(); // Button
        } else {
            $(this).removeClass("visible").addClass("hidden"); // Dropdown
            $(this).find('.more').show().siblings('.less').hide(); // Button
        }
    });
});

http://jsfiddle.net/divieto/uvz2ngsk/

一种实现方法是调用可见的单击。

$('.testoprodotto').on('click', function() {
    if ($(this).hasClass("hidden")) {
        $('.testoprodotto.visible').click();
        $(this).removeClass("hidden").addClass("visible");  
        /* rest of your code */

暂无
暂无

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

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