Guest User

Untitled

a guest
Nov 18th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. $(document).ready(function(){
  2. $('.accordion__trigger').on('click', function(e){
  3. e.preventDefault();
  4. var $this = $(this),
  5. item = $this.closest('.accordion__item'),
  6. list = $this.closest('.accordion__list'),
  7. items = list.find('.accordion__item'),
  8. content = item.find('.accordion__inner'),
  9. otherContent = list.find('.accordion__inner'),
  10. duration = 300;
  11.  
  12. if (!item.hasClass('.active')){
  13. item.removeClass('active');
  14. item.addClass('.active');
  15.  
  16. otherContent.stop(true, true).slideUp(duration);
  17. content.stop(true, true).slideDown(duration);
  18. } else {
  19. content.stop(true, true).slideUp(duration);
  20. item.stop(true, true).removeClass('.active');
  21. }
  22.  
  23.  
  24.  
  25. })
  26. })
Add Comment
Please, Sign In to add comment