0

hi as i am new to this jquery could any one help me with this i would like to show the div and hide the dive after trasnsition here is the script

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();
        }
    });

});

3 Answers 3

6

If you are using the multiple division (division inside division) in your form then you have to find the id of child div in the parent division like this.

$("#parentDiv").find("#childDiv").css("display", "block");      
$("#parentDiv").find("#childDiv").css("display", "none");
Sign up to request clarification or add additional context in comments.

Comments

5

if using the id for div then

$('#dividhere').attr('display','block') //to show
$('#dividhere').attr('display','none') //to hide

if using the class for div then

$('.divclasshere').attr('display','block') //to show
$('.divclasshere').attr('display','none') //to hide

4 Comments

@M1K1O sorry i didn't change the hide part after copy
How can it works ? you must change block to none in the hide row.
something like this jQuery(function($) { $('a.panel').click(function() { var $target = $($(this).attr('href')), $other = $target.siblings('.active'), animIn = function () { $target.addClass('active') $('.panel').attr('display','block') .show().css({ left: -($target.width()) }).animate({ left: 0 }, 300);
here i have created a fiddle whats happening is its inside a content and when it slides out it stays there only and the next div comes in i want the prev div to have display none so that it is not seen
2

Try show and hide in jquery,

 $('element').show();

 $('element').hide();

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.