1/******************************************************************************/ 2/******************************************************************************/ 3 4;(function($,doc,win) 5{ 6 "use strict"; 7 8 var Gallery=function(object,option) 9 { 10 /**********************************************************************/ 11 12 var $self=this; 13 var $this=$(object); 14 var $option=option; 15 16 /**********************************************************************/ 17 18 this.build=function() 19 { 20 var i=0; 21 var imageList=$this.find('img'); 22 var imageListCount=imageList.length; 23 24 imageList.each(function() 25 { 26 $(this).one('load',function() 27 { 28 if((++i)===imageListCount) 29 { 30 $self.createIsotope(true); 31 $this.css('opacity','1'); 32 } 33 }).each(function() 34 { 35 if(this.complete) $(this).load(); 36 }); 37 }); 38 }; 39 40 /**********************************************************************/ 41 42 this.createIsotope=function(bind) 43 { 44 var imageList=$this; 45 var imageListWidth=imageList.parent().actual('width'); 46 var columnCount=parseInt(imageList.parent().attr('data-column_count'),10); 47 48 var margin=40; 49 50 if(typeof(bind)==='undefined') bind=true; 51 52 if(imageList.parent().hasClass('theme-component-gallery-type-1')) 53 { 54 imageList.children('li').each(function() 55 { 56 var itemWidth=300; 57 58 if($(this).hasClass('theme-component-gallery-item-width-25')) 59 { 60 if(imageListWidth<460) itemWidth=130; 61 else if(imageListWidth<750) itemWidth=210; 62 else if(imageListWidth<940) itemWidth=157.5; 63 else if(imageListWidth<1220) itemWidth=205; 64 else itemWidth=275; 65 } 66 else 67 { 68 if(imageListWidth<460) itemWidth=300; 69 else if(imageListWidth<750) itemWidth=460; 70 else if(imageListWidth<940) itemWidth=355; 71 else if(imageListWidth<1220) itemWidth=450; 72 else itemWidth=590; 73 } 74 75 $(this).css('width',itemWidth); 76 }); 77 78 imageList.isotope( 79 { 80 layoutMode:'fitRows', 81 fitRows: 82 { 83 gutter:margin 84 } 85 }); 86 } 87 else if(imageList.parent().hasClass('theme-component-gallery-type-2')) 88 { 89 var itemWidth=(imageListWidth-(margin*(columnCount-1)))/columnCount; 90 91 if(itemWidth<=130) itemWidth='100%'; 92 93 imageList.children('li').css('width',itemWidth); 94 95 imageList.isotope( 96 { 97 layoutMode:'masonry', 98 masonry: 99 { 100 gutter:margin 101 } 102 }); 103 } 104 105 if(bind) 106 { 107 $(window).resize(function() 108 { 109 $self.createIsotope(false); 110 }); 111 } 112 }; 113 114 /**********************************************************************/ 115 }; 116 117 /**************************************************************************/ 118 119 $.fn.gallery=function(option) 120 { 121 return this.each(function() 122 { 123 var object=new Gallery(this,option); 124 object.build(); 125 return(object); 126 }); 127 }; 128 129 /**************************************************************************/ 130 131})(jQuery,document,window); 132 133/******************************************************************************/ 134/******************************************************************************/
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.