Mam taki kod który po najechaniu na li zwiększa szerokość a później powraca do poprzedniego rozmiaru.

Jak dodać do tego aby po na jechaniu na ten li reszta będzie się zmniejszać wraz z tym jak on się zwiększa, a jak się zjedzie z niego myszko to aby tamte też powróciły do swojego poprzedniego rozmiaru


Kod JS:
  1. $(function() {
  2. $('#accordion > li').hover(
  3. function () {
  4. var $this = $(this);
  5. $this.stop().animate({'width':'370px'},500);
  6. $('.heading',$this).stop(true,true).fadeOut();
  7. $('.bgDescription',$this).stop(true,true).slideDown(500);
  8. $('.description',$this).stop(true,true).fadeIn();
  9. },
  10. function () {
  11. var $this = $(this);
  12. $this.stop().animate({'width':'190px'},1000);
  13. $('.heading',$this).stop(true,true).fadeIn();
  14. $('.description',$this).stop(true,true).fadeOut(500);
  15. $('.bgDescription',$this).stop(true,true).slideUp(700);
  16. }
  17. );
  18. });


Kod HTML
  1. <ul class="accordion" id="accordion">
  2. <li class="bg1">
  3. <div class="heading">Heading</div>
  4. <div class="bgDescription"></div>
  5. <div class="description">
  6. <h2>Heading</h2>
  7. <p>Some descriptive text</p>
  8. <a href="#">more ?</a>
  9. </div>
  10. </li>
  11. <li class="bg2">
  12. <div class="heading">Heading</div>
  13. <div class="bgDescription"></div>
  14. <div class="description">
  15. <h2>Heading</h2>
  16. <p>Some descriptive text</p>
  17. <a href="#">more ?</a>
  18. </div>
  19. </li>
  20. <li class="bg3">
  21. <div class="heading">Heading</div>
  22. <div class="bgDescription"></div>
  23. <div class="description">
  24. <h2>Heading</h2>
  25. <p>Some descriptive text</p>
  26. <a href="#">more ?</a>
  27. </div>
  28. </li>
  29. <li class="bg4">
  30. <div class="heading">Heading</div>
  31. <div class="bgDescription"></div>
  32. <div class="description">
  33. <h2>Heading</h2>
  34. <p>Some descriptive text</p>
  35. <a href="#">more ?</a>
  36. </div>
  37. </li>
  38. <li class="bg5">
  39. <div class="heading">Heading</div>
  40. <div class="bgDescription"></div>
  41. <div class="description">
  42. <h2>Heading</h2>
  43. <p>Some descriptive text</p>
  44. <a href="#">more ?</a>
  45. </div>
  46. </li>
  47. </ul>


Prawie mi się udało

  1. <script type="text/javascript">
  2. $(function() {
  3. $('#accordion > li').hover(
  4. function () {
  5. $('#accordion > li:not(hover)').animate({'width':'170px'},500);
  6. var $this = $(this);
  7. $this.stop().animate({'width':'270px'},500);
  8. $('.heading',$this).stop(true,true).fadeOut();
  9. $('.bgDescription',$this).stop(true,true).slideDown(500);
  10. $('.description',$this).stop(true,true).fadeIn();
  11. },
  12. function () {
  13. var $this = $(this);
  14. $this.stop().animate({'width':'190px'},500);
  15. $('#accordion > li:not(hover)').animate({'width':'190px'},500);
  16. $('.heading',$this).stop(true,true).fadeIn();
  17. $('.description',$this).stop(true,true).fadeOut(500);
  18. $('.bgDescription',$this).stop(true,true).slideUp(700);
  19. }
  20. );
  21. });


tylko ze jakos dziwnie to dziala