Guest User

Untitled

a guest
Apr 22nd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. /* =============================================================================
  2. Functions
  3. ========================================================================== */
  4.  
  5.  
  6. /* =============================================================================
  7. DOM ready
  8. ========================================================================== */
  9.  
  10. $(function() {
  11.  
  12. var $container = $('#isotopeContainer'),
  13. filters = {};
  14.  
  15. $container.isotope({
  16. itemSelector : '.isotope-item',
  17. masonry: {
  18. columnWidth: 150
  19. }
  20. });
  21.  
  22. // filter buttons
  23. $('.filter a').click(function(){
  24. var $this = $(this);
  25. // don't proceed if already active
  26. if ( $this.hasClass('active') ) {
  27. return;
  28. }
  29.  
  30. var $optionSet = $this.parents('.option-set');
  31. // change active class
  32. $optionSet.find('.active').removeClass('active');
  33. $this.addClass('active');
  34.  
  35. // store filter value in object
  36. // i.e. filters.color = 'red'
  37. var group = $optionSet.attr('data-filter-group');
  38. filters[ group ] = $this.attr('data-filter-value');
  39. // convert object into array
  40. var isoFilters = [];
  41. for ( var prop in filters ) {
  42. isoFilters.push( filters[ prop ] )
  43. }
  44. var selector = isoFilters.join('');
  45. $container.isotope({ filter: selector });
  46.  
  47. return false;
  48. });
  49.  
  50. $('ul.storyNavigation li a').click(function(event){
  51. $('ul.storyNavigation li a').removeClass('active');
  52. $(this).addClass('active');
  53. $('.storyBox').stop().fadeOut('fast');
  54. $('.'+ event.target.id).stop().delay('fast').fadeIn('fast');
  55. });
  56. if ($('ul.storyNavigation').length != 0){
  57. var firstCategory = $('ul.storyNavigation li:first-child a').attr('id');
  58. $('#'+firstCategory).addClass('active');
  59. $('.'+firstCategory).fadeIn('fast');
  60. }
  61.  
  62.  
  63. });
Add Comment
Please, Sign In to add comment