DMar
DMar

Reputation: 187

How could I make a div "slide" to a certain width using jquery?

I have a div that scales to an image width + height using jquery. I want to know if I can make it "slide" to the width and height.

So instead of just instantly scaling to those dimensions, I want a nice transaction slide.

Upvotes: 2

Views: 1439

Answers (4)

ONYX
ONYX

Reputation: 5859

Try this

$('div').animate({'width': '+= 50'});

that may work

Upvotes: 0

Winter
Winter

Reputation: 368

It depends on how you want to animate it. In addition to .animate, and .show, there is also

$("div").slideUp();

see: http://api.jquery.com/slideUp/

$("div").slideDown("slow");

see: http://api.jquery.com/slideDown/

Upvotes: 0

Linens
Linens

Reputation: 7942

$('#div').animate({width:500+'px', height:500+'px'});

Replace 500 with your dimensions

Upvotes: 2

Nanne
Nanne

Reputation: 64399

You could use "show" ?

$("yourSelector").show("slow");

see: http://api.jquery.com/show/

Upvotes: 0

Related Questions