Prepend and slidedown

Steve Tinsley
Steve Tinsley used Ask the Experts™
on
I have a script which checks for new rows and prepends them to the top of the list.

I would like the prepend to be nicer.

Perhaps with a slide-in and fade. As well as slide down the others that are already in the list.

Currently I have this:

function prepend(rowData) {
  $(".div").prepend(htmlData);
}

Open in new window


but it is very clunky.

Could anyone help with some nicer looking animation.

Thanks

Steve
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Multitechnician
Top Expert 2014
Commented:
Test page : http://jsfiddle.net/2tLL6/

function prepend(rowData) {
    var h = $(".div div:first").height();
    var htmlData = $(rowData).height("0px");
    htmlData.prependTo(".div").animate({height:h}, 1000);
}

Open in new window

Author

Commented:
Thanks for that. Worked first time!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial