JQuery - Find the first identical class after a specific class.

Posted by WEBProject on Stack Overflow See other posts from Stack Overflow or by WEBProject
Published on 2011-02-03T07:24:04Z Indexed on 2011/02/03 7:25 UTC
Read the original article Hit count: 128

Filed under:

Hi guys,

lets say I have this divs:

<div class="item current"><strong>Example 1</strong></div>
<div class="item"><strong>Example 2</strong></div>

Im have this code:

var News = {
   init : function(){
      $('#news-content')
        .find('.item:first-child')
        .addClass('current')
        .show('slide',{direction:"up"},500);

      $('#news-content')
        .find('.item:first-child')
        .addClass('current')
        .delay(1000)
        .hide('slide',{direction:"down"},500);

        this.show()

  },

  show : function() {
    // ...
  }
}

$(document).ready(News.init)

After the init - I want to catch the next "item" after "current" class and make the same operation as "init" on it. how can I do it with jquery?

© Stack Overflow or respective owner

Related posts about jQuery