Search code examples
javascriptjquerynivo-slider

Trying to use :not to select ids and have the respective slideshows turn off


This is not being recognised. I get a syntax error saying

illegal character on column 29.

When clicking any button (#c1 - #c4) the slider stops. I believe that it isn't recognising the not.

$('div.nivoSlider:not('#c' + id)').data('nivoslider').stop();

Yet to start a specific slideshow this is working.

$('#c' + id).nivoSlider({ effect: 'fade' }); 

I initially have slider #c1 starting on load. Thank you.


Solution

  • Looking at your code, you are cutting off your string too early. (Look at the syntax highlighting colors here for the clue)

    Try this:

    $('div.nivoSlider:not(#c' + id + ')').data('nivoslider').stop();