title: slide to the right with next();
body: <p>What im trying to do is the next time i click .div the last one animates and make what else function does, i still dont figure how to do that</p>
  
  <pre><code>$(".div").click(function() {
      /*with this code i make that the next time i open .show, the last one closes */
      $(this).next('.show').slideToggle();
      $(this).parent().siblings().children().next().slideUp();
      /*here i use a flag to slide a div and make some animations*/
      if (!$(this).hasClass("flag")) {
          $(this).animate({
              marginLeft: '-=400px'
          }, 100);
          $(this).addClass("flag");
          $(this).find("h1").animate({
              backgroundColor: 'black'
          }, 500);
          $(this).find("h1").css("color", "white");
          $(this).find("h1").addClass("class1");
      } else {
          $(this).animate({
              marginLeft: '+=400px'
          }, 100);
          $(this).removeClass("flag");
          $(this).find("h1").animate({
              backgroundColor: 'transparent'
          }, 500);
          $(this).find("h1").css("color", "black");
          $(this).find("h1").removeClass("class1");
      };
      return false;
  });
  </code></pre>