Skip to content

Commit a4849b5

Browse files
committed
Issue 2142: Sort components alphabetically
1 parent 7b3d82f commit a4849b5

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

source/components/index.html

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,24 @@
9797
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.isotope/2.2.2/isotope.pkgd.min.js"></script>
9898
<script>
9999
$(window).load(function(){
100-
var $container = $('#componentContainer');
100+
var $isotope = $('#componentContainer').isotope({
101+
filter: '.featured',
102+
animationOptions: {
103+
duration: 750,
104+
easing: 'linear',
105+
queue: false
106+
},
107+
masonry: {
108+
columnWidth: 210
109+
},
110+
getSortData: {
111+
title: function( itemElem ) {
112+
var title = $( itemElem ).find('.title').text();
113+
return title ? title.toLowerCase() : '';
114+
}
115+
},
116+
sortBy: 'title'
117+
});
101118

102119
function updateHash(newHash) {
103120
if ('replaceState' in history) {
@@ -123,17 +140,9 @@
123140
$('.filter-button-group a.current').removeClass('current');
124141
$('.filter-button-group a[href='+hash+']').addClass('current');
125142

126-
$container.isotope({
127-
filter: filter,
128-
animationOptions: {
129-
duration: 750,
130-
easing: 'linear',
131-
queue: false
132-
},
133-
masonry: {
134-
columnWidth: 210
135-
}
136-
});
143+
$isotope.isotope({
144+
filter: filter
145+
});
137146
}
138147

139148
jQuery('.filter-button-group a').click(function() {

0 commit comments

Comments
 (0)