Mix911
Mix911

Reputation: 55

JS .show .hide direction

I have this function:

$('.Show').click(function() {
    $('#mobile-nb-c').show(500);
    $('.Show').hide(500);
    $('.Hide').show(500);
});

This function opens my div like this: show/hide img1

But I would like it to make it open like this: show/hide img2

Can this be done?

Upvotes: 0

Views: 283

Answers (2)

ellipsis
ellipsis

Reputation: 12152

show() and hide() both do not have any animation properties related to them. They will just hide an element or show it. You can use .animate() for using all sorts of animations

Upvotes: 2

Paul Losev
Paul Losev

Reputation: 1089

Try this:

$('.Show').animate({ width: <yourWidth> }, 600)
$('.Hide').animate({ width: 0 }, 600)

Upvotes: 0

Related Questions