views:

64

answers:

2

Heya everyone

I been struggling along with this piece of code for the longest time, its driving me insane. I am trying many different things and looking at past posts here but nothing seems to be helping.

Basicly i have a jquery pagination code in place and i want to add animated transitions between pages. With some assistance i got that working correctly however this causes the page to jump around as the new items fade in and out. To fix this i need a DIV wrapped around each selection of results. I have been trying to use .wrap .html .wrapinner .append and i cant get any of it to work properly.

The 2 areas where i beleive the code needs to be place are as follows:

$('#content').children().slice(0, show_per_page).css('display', 'block');

and

$('#content').children().fadeOut('slow').slice(start_from, end_on).fadeIn('slow');

Full original code: http://tutsvalley.com/tutorials/making-a-jquery-pagination-system/

Only the second line of code posted here has been altered.

Basicly i want to wrap each group of sliced output in a DIV.

I hope that makes sense, if you need anymore information please let me know. Any ideas or suggestions on what to try it would be much apreciated as its currently driving me crazy :)

Ludz~

A: 

Hi,

i don't understand why you want to wrap the content in a div. They are already in a div - so you can give this one a height and jumping should be solved. Or did I get you wrong?

Felix

Felix
FelixCheers for taking a look. What you have said will work to an extent however it still leaves me with a problem. The page itself is adjustable. So sometimes 6 items will be shown, other times 9 may be ect ect. Which means the height cannot be set in stone.The reason i want extra divs around each set of items is so i can set the position to absolute. This will let the fade effect take place but the next set of items that is shown will be in exactly the same place, making a seamless transition. I hope that makes sense.Any ideas?Ludz~
ludz
A: 

Contact me using the contact form on tutsvalley.com, will try to sort it out :)

THE SOLUTION:

$('#content').children().fadeOut(500).delay(500).slice(start_from, end_on).fadeIn(500);

NOTICE: Make sure you're using the newest version of jquery. (the delay() is introduced in 1.4)

Slobodan Kustrimovic
Thanks, I will be in touch shortly :)
ludz
Thank you, that has worked perfectly :)
ludz