jquery split ul into two


/ Published in: jQuery
Save to your folder(s)

@davidlink
aim: instanteggrolls


Copy this code and paste it in your HTML
  1. $(document).ready(function(){
  2. $('.splitcol').each(function(i){
  3. var colsize = Math.round($(this).find("li").size() / 2);
  4. $(this).find("li").each(function(i) {
  5. if (i>=colsize){
  6. $(this).addClass('splitcol_right');
  7. }
  8. }
  9. )
  10. $(this).find('.splitcol_right').insertAfter(this).wrapAll("<ul class='left'></ul>");
  11. }
  12. )
  13. });

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.