1jQuery.noConflict(); 2 3var shuffleme = (function( $ ) { 4 'use strict'; 5 var $grid = $('#grid'), //locate what we want to sort 6 $filterOptions = $('.portfolio-sorting li'), //locate the filter categories 7 $sizer = $grid.find('.shuffle_sizer'), //sizer stores the size of the items 8 9 init = function() { 10 11 // None of these need to be executed synchronously 12 setTimeout(function() { 13 listen(); 14 setupFilters(); 15 }, 100); 16 17 // instantiate the plugin 18 $grid.shuffle({ 19 itemSelector: '[class*="col-"]', 20 sizer: $sizer 21 }); 22 }, 23 24 25 26 // Set up button clicks 27 setupFilters = function() { 28 var $btns = $filterOptions.children(); 29 $btns.on('click', function(e) { 30 e.preventDefault(); 31 var $this = $(this), 32 isActive = $this.hasClass( 'active' ), 33 group = isActive ? 'all' : $this.data('group'); 34 35 // Hide current label, show current label in title 36 if ( !isActive ) { 37 $('.portfolio-sorting li a').removeClass('active'); 38 } 39 40 $this.toggleClass('active'); 41 42 // Filter elements 43 $grid.shuffle( 'shuffle', group ); 44 }); 45 46 $btns = null; 47 }, 48 49 // Re layout shuffle when images load. This is only needed 50 // below 768 pixels because the .picture-item height is auto and therefore 51 // the height of the picture-item is dependent on the image 52 // I recommend using imagesloaded to determine when an image is loaded 53 // but that doesn't support IE7 54 listen = function() { 55 var debouncedLayout = $.throttle( 300, function() { 56 $grid.shuffle('update'); 57 }); 58 59 // Get all images inside shuffle 60 $grid.find('img').each(function() { 61 var proxyImage; 62 63 // Image already loaded 64 if ( this.complete && this.naturalWidth !== undefined ) { 65 return; 66 } 67 68 // If none of the checks above matched, simulate loading on detached element. 69 proxyImage = new Image(); 70 $( proxyImage ).on('load', function() { 71 $(this).off('load'); 72 debouncedLayout(); 73 }); 74 75 proxyImage.src = this.src; 76 }); 77 78 // Because this method doesn't seem to be perfect. 79 setTimeout(function() { 80 debouncedLayout(); 81 }, 500); 82 }; 83 84 return { 85 init: init 86 }; 87}( jQuery )); 88 89jQuery(document).ready(function() 90{ 91 shuffleme.init(); //filter portfolio 92});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.