Skip to content

Instantly share code, notes, and snippets.

@kkotaro0111
Created December 23, 2016 16:04
Show Gist options
  • Save kkotaro0111/efa797296052615e4f515348bc2492b4 to your computer and use it in GitHub Desktop.
Save kkotaro0111/efa797296052615e4f515348bc2492b4 to your computer and use it in GitHub Desktop.
SHOWROOMのONLINE一覧を、View数で並び替えるjQueryスクリプト
var Panel = function(el){
this.el = $(el);
this.view = this.el.find('.is-onlive').text();
};
var $cll = $('.contentlist-list');
var ary = [];
$cll.find('li').each(function(){
var $self = $(this);
ary.push( new Panel($self) );
});
ary.sort(function(a ,b){
return b.view - a.view;
});
$cll.first().empty();
$.each(ary, function(){
$cll.first().append(this.el);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment