如何点击加号按钮展开div,然后点击所有div?

时间:2015-07-17 05:18:32

标签: javascript jquery html click

我有一个portlet-div,它有portlet-toggle,是展开/折叠的减号/加号图标,但当我点击它时,div被选中了。我该怎么办?

的portlet:

<div class="portlet portlet-count firstTab" id="1">
     <div class="portlet-header">First</div>
     <div class="portlet-content">test-test-test</div>
</div>

$(".portlet")
      .addClass("ui-widget ui-widget-content ui-helper-clearfix ui-corner-all")
      .find(".portlet-header")
        .addClass("ui-widget-header ui-corner-all")
        .prepend("<span class='ui-icon ui-icon-minusthick portlet-toggle'></span>");

    $(".portlet-toggle").click(function () {
        var icon = $(this);
        icon.toggleClass("ui-icon-minusthick ui-icon-plusthick");
        icon.closest(".portlet").find(".portlet-content").toggle();  
    });

的javascript:

$('.frame .portlet').click(function () {
    var $this = $(this),
        $error;
    if ($this.hasClass('added')) {
        $error = $this.next('.clone-error');
        if (!$error.length) {
            $error = $('<span />', {
                'class': 'clone-error',
                html: '<div class="alert alert-warning" role="alert" style="width: 300px"> This question is already added!</div>'
            }).insertAfter(this);
        }
        $error.stop().show().delay(800).hide(1);
    } else {
        $this.addClass('added').clone().appendTo('#creation .newFrame');
        count++;
    }
});

0 个答案:

没有答案