Advertisement
dalbeck

Untitled

Sep 28th, 2013
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 1.84 KB | None | 0 0
  1. // Work Page - Smooth Filtering
  2. jQuery(document).ready(function(){
  3.   var $container = jQuery('.work_items');
  4.  
  5.   $container.isotope({
  6.     itemSelector : '.work_item'
  7.   });
  8.  
  9.   var $optionSets = jQuery('#work_nav .work_tags_nav'),
  10.       $optionLinks = $optionSets.find('a');
  11.  
  12.   $optionLinks.click(function(){
  13.     var $this = jQuery(this);
  14.     // don't proceed if already selected
  15.     if ( $this.hasClass('selected') ) {
  16.       return false;
  17.     }
  18.     var $optionSet = $this.parents('.work_tags_nav');
  19.     $optionSet.find('.selected').removeClass('selected');
  20.     $this.addClass('selected');
  21.  
  22.     // make option object dynamically, i.e. { filter: '.my-filter-class' }
  23.     var options = {},
  24.         key = $optionSet.attr('data-option-key'),
  25.         value = $this.attr('data-option-value');
  26.     // parse 'false' as false boolean
  27.     value = value === 'false' ? false : value;
  28.     options[ key ] = value;
  29.     if ( key === 'layoutMode' && typeof changeLayoutMode === 'function' ) {
  30.       // changes in layout modes need extra logic
  31.       changeLayoutMode( $this, options )
  32.     } else {
  33.       // otherwise, apply new options
  34.       $container.isotope( options );
  35.     }
  36.     return false;
  37.     });
  38.    
  39.   // Call infinite scroll
  40.   $container.infinitescroll({
  41.         navSelector  : '#page_nav',    // selector for the paged navigation
  42.         nextSelector : '#page_nav a',  // selector for the NEXT link (to page 2)
  43.         itemSelector : '.work_item',     // selector for all items you'll retrieve
  44.         loading: {
  45.             finishedMsg: 'No projects to load.',
  46.             img: 'http://graphicd-signs.com/main/wp-content/uploads/2013/06/ajax-loader.gif'
  47.           }
  48.         },
  49.         // call Isotope as a callback
  50.         function( newElements ) {
  51.           $container.isotope( 'appended', jQuery( newElements ) );
  52.    });    
  53.    
  54. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement