0

I'm trying to implement jquery serialScroll on one of my carousels with prev/ next buttons however i'm only able to get it to work when I pass in unique id's for prev and next. what I would like to do is pass in a selector.

So with markup like this:

<div id="screen">
..
<img class="prev" ..>
..
<img class="next" ..>
..
</div>

This seems to work:

$(#screen).serialScroll({
  //..
  prev: 'img.prev',
  next: 'img.next'
});

But this does not:

$(#screen).serialScroll({
  //..
  prev: '#screen .prev',
  next: '#screen .next'
});
9-bits
  • 10,395
  • 21
  • 61
  • 83

2 Answers2

1

You are setting prev and next on a tag (prev and next). Change to #screen .prev and #screen .next (notice the dot) and it should work.

Marwelln
  • 28,492
  • 21
  • 93
  • 117
  • Sorry - that was a typo in my question...i am using #screen .prev and #screen .next (just updated that) – 9-bits Oct 22 '11 at 17:46
0

Better late than never - the plugin selects items within the context of the selector.

function getItems(){
    return $( items, pane );
};

So with your latter snippet, it actually evaluates to #screen #screen .prev, hence why none are found ;)

TheDeadMedic
  • 9,948
  • 2
  • 35
  • 50