0

I have a JQuery slider that, for each slide, needs to show what slide is coming next. That is, at the bottom of each slide, it will say, Next: Lorem Ipsum Dolor--the headline of my next slide.

I'm thinking the best way to do this might be to make the slides channel entries, and use the Next Entry tag to pull the name of the next entry.

Only problem is, when I get to the last slide, the "Next" will be empty. Is there any way to link back to the first slide? Is there a conditional that tells EE, if there is no "next", then pull from the first slide?

Thanks

1

It seems to me, you could achieve this with javascript more easily.

Basically, you would cycle through each slide and append the title of the next slide to it. If there is no next slide, take the title from the first slide.

Here's a really rough example: http://jsfiddle.net/alexroper/jLHwV/1/

If you want to do this programmatically with EE, it looks like the Advanced Prev Next Entry by Biber Ltd could work for you. There is an {empty_next} variable you could test with a conditional. But you're adding extra queries for each slide so you may run into performance issues as you add more slides.

Take a look at the documentation here: http://biberltd.com/en/documentation/software/advanced_prev_next_entry

My guess is the EE plugin option would cost you more performance than the small amount of overhead you would add to browser rendering with the javascript option.

1
  • Alex, thank very much, I hadn't though about the idea idea of using JS. Makes sense!
    – MDLG
    Sep 25 '13 at 22:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.