Skip to content

Commit 6b44330

Browse files
authored
Merge pull request pytorch#657 from shiftlab/randomize-ecosystem-cards-on-refresh
Randomize ecosystem cards on refresh
2 parents 4b76f4c + 02e11ad commit 6b44330

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

ecosystem/ecosystem.html

+12
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,18 @@ <h1>
121121
$(this).attr("data-date-added", date);
122122
});
123123

124+
//Randomize Ecosystem cards on page reload
125+
$.fn.randomize = function(ecosystemCards) {
126+
(ecosystemCards ? this.find(ecosystemCards) : this).parent().each(function() {
127+
$(this).children(ecosystemCards).sort(function() {
128+
return Math.random() - 0.5;
129+
}).detach().appendTo(this);
130+
});
131+
return this;
132+
};
133+
134+
$('#ecosystem-index-cards').randomize('#ecosystemCards');
135+
124136
</script>
125137

126138
<script src="//cdnjs.cloudflare.com/ajax/libs/list.js/1.5.0/list.min.js"></script>

0 commit comments

Comments
 (0)