Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. var groups = {};
  2. $(".product-list .product-list_item").each(function(i) {
  3. var c = $(this).attr("class");
  4. if(!groups[c]) groups[c] = [];
  5. groups[c].push(this);
  6. });
  7. for(var i in groups) {
  8. $(groups[i]).wrapAll('<div class="product-list_row" />').each(function(i){
  9. if (((i+1) % 3) == 0)
  10. $(this).after('</div><div class="product-list_row">');
  11. });
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement