Javascript 使用jQuery切换仅影响一个元素

Javascript 使用jQuery切换仅影响一个元素,javascript,jquery,jquery-ui,Javascript,Jquery,Jquery Ui,所以我得到了这个密码 $('.item').click(function () { if ($(".secondary", this).is(":hidden")) { $(".primary", this).toggle('slide', { direction: 'right' }, 500, function () { $('.secondary', this).toggle('slide', {

所以我得到了这个密码

$('.item').click(function () {
    if ($(".secondary", this).is(":hidden")) {
        $(".primary", this).toggle('slide', {
            direction: 'right'
        }, 500, function () {
            $('.secondary', this).toggle('slide', {
                direction: 'left'
            }, 500);
        });

    }
});
当前的行为是,当我单击.item时,.primary会向右滑动,但是.secondary根本不会滑入

小提琴:


真不敢相信我居然没看到它。谢谢。@Seven有时我们在编码时都会感到困惑,有时简单的事情会带来问题。。所以没关系。。祝你好运:)我真不敢相信我没看到它。谢谢。@Seven有时我们在编码时都会感到困惑,有时简单的事情会带来问题。。所以没关系。。祝你好运:)我真不敢相信我没看到它。谢谢。@Seven有时我们在编码时都会感到困惑,有时简单的事情会带来问题。。所以没关系。。祝你好运:)我真不敢相信我没看到它。谢谢。@Seven有时我们在编码时都会感到困惑,有时简单的事情会带来问题。。所以没关系。。祝你好运:)
$('.item').click(function () {
    var $this = $(this);
    if ($(".secondary", this).is(":hidden")) {
        $(".primary", $this).toggle('slide', {
            direction: 'right'
        }, 500, function () {
            $('.secondary', $this).toggle('slide', {
                direction: 'left'
            }, 500);
        });

    }
});