Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* =============================================================================
- Functions
- ========================================================================== */
- /* =============================================================================
- DOM ready
- ========================================================================== */
- $(function() {
- var $container = $('#isotopeContainer'),
- filters = {};
- $container.isotope({
- itemSelector : '.isotope-item',
- masonry: {
- columnWidth: 150
- }
- });
- // filter buttons
- $('.filter a').click(function(){
- var $this = $(this);
- // don't proceed if already active
- if ( $this.hasClass('active') ) {
- return;
- }
- var $optionSet = $this.parents('.option-set');
- // change active class
- $optionSet.find('.active').removeClass('active');
- $this.addClass('active');
- // store filter value in object
- // i.e. filters.color = 'red'
- var group = $optionSet.attr('data-filter-group');
- filters[ group ] = $this.attr('data-filter-value');
- // convert object into array
- var isoFilters = [];
- for ( var prop in filters ) {
- isoFilters.push( filters[ prop ] )
- }
- var selector = isoFilters.join('');
- $container.isotope({ filter: selector });
- return false;
- });
- $('ul.storyNavigation li a').click(function(event){
- $('ul.storyNavigation li a').removeClass('active');
- $(this).addClass('active');
- $('.storyBox').stop().fadeOut('fast');
- $('.'+ event.target.id).stop().delay('fast').fadeIn('fast');
- });
- if ($('ul.storyNavigation').length != 0){
- var firstCategory = $('ul.storyNavigation li:first-child a').attr('id');
- $('#'+firstCategory).addClass('active');
- $('.'+firstCategory).fadeIn('fast');
- }
- });
Add Comment
Please, Sign In to add comment