Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function(){
- $('.usersrandom').each(function(){
- var users = ["/u2", "/u3", "/u4", "/u5", "/u6", "/u7", "/u8"];
- var size = users.length;
- var a = Math.floor(size*Math.random());
- var b = Math.floor(size*Math.random());
- var c = Math.floor(size*Math.random());
- var d = Math.floor(size*Math.random());
- var e = Math.floor(size*Math.random());
- var $self = $(this);
- /* Tendrías que repetir esto tantas veces como variables de randomización tengas */
- $.get(users[a], function(data) {
- var randomAvatar = $(data).find('.psavatar').html();
- var randomUsername = $(data).find('.psname').html();
- $self.append('<div class="userrandom userrandom-a"><div class="ur-avatar">'+randomAvatar+'</div><div class="ur-name">'+randomUsername+'</div></div>');
- });
- $.get(users[b], function(data) {
- var randomAvatar = $(data).find('.psavatar').html();
- var randomUsername = $(data).find('.psname').html();
- $self.append('<div class="userrandom userrandom-b"><div class="ur-avatar">'+randomAvatar+'</div><div class="ur-name">'+randomUsername+'</div></div>');
- });
- $.get(users[c], function(data) {
- var randomAvatar = $(data).find('.psavatar').html();
- var randomUsername = $(data).find('.psname').html();
- $self.append('<div class="userrandom userrandom-c"><div class="ur-avatar">'+randomAvatar+'</div><div class="ur-name">'+randomUsername+'</div></div>');
- });
- $.get(users[d], function(data) {
- var randomAvatar = $(data).find('.psavatar').html();
- var randomUsername = $(data).find('.psname').html();
- $self.append('<div class="userrandom userrandom-d"><div class="ur-avatar">'+randomAvatar+'</div><div class="ur-name">'+randomUsername+'</div></div>');
- });
- $.get(users[e], function(data) {
- var randomAvatar = $(data).find('.psavatar').html();
- var randomUsername = $(data).find('.psname').html();
- $self.append('<div class="userrandom userrandom-e"><div class="ur-avatar">'+randomAvatar+'</div><div class="ur-name">'+randomUsername+'</div></div>');
- });
- });
- });
Add Comment
Please, Sign In to add comment