Created
December 23, 2016 16:04
-
-
Save kkotaro0111/efa797296052615e4f515348bc2492b4 to your computer and use it in GitHub Desktop.
SHOWROOMのONLINE一覧を、View数で並び替えるjQueryスクリプト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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