1

I'm using the code below to initiate a slideshow:

target.cycle({
            timeout: 0,
            before: onBefore,
            after: onAfter,
            next: target + ', #slide-next',
            prev: '#slide-prev'
        })

My only problem is I'm having trouble defining the next parameter which is supposed to take the selector of the slideshow itself; the variable target and the id of #slide-next

Unfortunately this code does not work.

When I use next: '#slide-next', the slides transition when I press the next button, when I use, next: target, the slides transition when I click on the slides themselves but when I use next: target + ',#slide-next', they transition only when I click on the slideshow and not on the next button.

How do I need to define next?

6
  • 2
    In what way does it "not work"? There's nothing obviously wrong with that code. Commented Oct 16, 2011 at 20:15
  • 1
    What's the value of target? Commented Oct 16, 2011 at 20:19
  • I don't think you're using it right, from the docs next: null, // element, jQuery object, or jQuery selector string for the element to use as event trigger for next slide Commented Oct 16, 2011 at 20:21
  • when I use next: '#slide-next', the slides transition when I press the next button, when I use, next: target, the slides transition when I click on the slides themselves but when I use next: target + ', #slide-next', they transition only when I click on the slideshow and not on the next button. Commented Oct 16, 2011 at 20:22
  • The value of target is a selector string for a div containing a list of images, for example #slideshow. Commented Oct 16, 2011 at 20:24

2 Answers 2

1
var next = target.add("#slide-next");    

target.cycle({
        timeout: 0,
        before: onBefore,
        after: onAfter,
        next: next,
        prev: '#slide-prev'
})
Sign up to request clarification or add additional context in comments.

Comments

0

I'm not sure what you want to set as next, but here is some hint that might help you.

In the element put some attribute that represents a selector of the next element that should be shown e.g.:

 <div id="s1" data-next="#s2">...</div>

In your initialization put some code that take the current element and use data-next as an attribute for next:

target.cycle({
        timeout: 0,
        before: onBefore,
        after: onAfter,
        next: $(target).attr("data-next"),
        prev: '#slide-prev'
    })

You will probably need to modify this code but I hope that you see what is idea.

Jovan

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.