tags:

views:

157

answers:

2

I'm using the following script to toggle between divs. Functionally it works but I'm getting the following error when I check it: 'Unknown pseudo-class or pseudo-element 'eq'. Dangling combinator.'

$(document).ready(function() {

    $('#slide2, #slide3').hide();

    $('#navCol a').each(function(index) {
      $(this).click(function() {
        var $thisPanel = $('#slideContainer > div:eq(' + index + ')');
        if ($thisPanel.siblings(':visible').length) {
          $thisPanel.siblings(':visible').slideUp(250, function() {
            $thisPanel.slideDown(250);
          });

        }

        return false;
      });
    });
  });

Can anyone tell me how to fix this or a better way to work this code? Thank you!

A: 

Try changing this:

$('#slideContainer > div:eq(' + index + ')');

To this:

$('#slideContainer > div').eq(index);
inkedmn
That did it. Thank you!
Mark
A: 

Make sure you are using jquery 1.3.2, the :eq() selector is quite recent.

    var $thisPanel = $('#slideContainer > div:eq(' + index + ')');

To avoid the error, you could try

    var $thisPanel = $('#slideContainer > div').eq(index );
pixeline