1

I have a asp.net listview, on each one of these listviews I have an image of a next and a previous button. But to my knowledge you just can call next or prev in jQuery Cycle you have to say which button will cause it to go to the next slide. So since I am adding these prevnext images dynamically, is there way of just calling a function that will go to the next slide or something? Thanks for any help.

user516883
  • 8,868
  • 23
  • 72
  • 114

1 Answers1

0

You would wire up your next and previous buttons using jQuery's on() function, so that dynamically added content will automatically be wired up.

When adding your next and previous buttons, add a class identifier to them. For example, on your next buttons, add a class=next, and then wire it up like this:

$(document).on("click", ".next", function() {
   callNextInCycle();
});

Wiring it up this way has the added benefit that if your listBox initially has 1000 items, jQuery will not waste time going through and attaching the event to all those items.

Adam Rackis
  • 82,527
  • 56
  • 270
  • 393