jquery显示块/无

Md *_*eem 0 jquery

嗨,因为我是这个jquery的新手可以任何人帮助我这个我想显示div并隐藏潜水后trasnsition这里是脚本

jQuery(function($) {

    $('a.panel').click(function() {
        var $target = $($(this).attr('href')),
            $other = $target.siblings('.active'),
            animIn = function () {
                $target.addClass('active').show().css({
                    left: -($target.width())
                }).animate({
                    left: 0
                }, 300);
            };

        if (!$target.hasClass('active') && $other.length > 0) {
            $other.each(function(index, self) {
                var $this = $(this);
                $this.removeClass('active').animate({

                    left: -$this.width()
                }, 300, animIn);
            });
        } else if (!$target.hasClass('active')) {
            animIn();
        }
    });

});
Run Code Online (Sandbox Code Playgroud)

Bhu*_*kla 6

如果您在表单中使用多重除法(除法内部除法),则必须在父除法中找到子div的id,如下所示.

$("#parentDiv").find("#childDiv").css("display", "block");      
$("#parentDiv").find("#childDiv").css("display", "none");
Run Code Online (Sandbox Code Playgroud)


Vin*_*ngh 5

如果使用id为div然后

$('#dividhere').attr('display','block') //to show
$('#dividhere').attr('display','none') //to hide
Run Code Online (Sandbox Code Playgroud)

如果使用div的类那么

$('.divclasshere').attr('display','block') //to show
$('.divclasshere').attr('display','none') //to hide
Run Code Online (Sandbox Code Playgroud)