Code

Split CMS Collection into Multiple Sections

Split up your Webflow CMS collections into multiple sections with this Javascript code snippet. This allows you to easily break up a collection lists into multiple sections, a great way of adding your own elements in between a Webflow CMS collection list.

Split CMS Collection into Multiple Sections preview

Split up your Webflow CMS collections into multiple sections with this Javascript code snippet. This allows you to easily break up a collection lists into multiple sections, a great way of adding your own elements in between a Webflow CMS collection list.

How to add it

  1. Add the Javascript code snippet to the closing body section
  2. Update class names to your own class names

The code

Javascript
                      <!-- Add to closing body section -->
<script>
$(function() {
  for (var i = 0; i < $('.tr-wrap .tr-category').length; i++) {
    var name = $('.tr-wrap .tr-category').eq( i );
    for (var d = 0; d < $('.tr-title').length; d++) {
    	var title = $('.tr-title').eq( d );
      if ( title.text() == name.text()  ) {
      		var parent = name.closest('.tr-item');
          var titleContain = title.closest('.tr-contain').find('.tr-list');
      		parent.appendTo( titleContain );
      }
    }
  }
});
</script>

                    

Browse similar code snippets

Language

More from Timothy Ricks

Profile →

Similar code snippets

All code snippets →