$(document).on("click", "a[data-trigger='colorbox']",function(e){
This binds a click event to the document and all child elements within it. This click event then checks if the clicked element matches the filter a[data-trigger='colorbox']
the later:
$("a[data-trigger='colorbox']").on("click",function(e){
binds the click event to the a[data-trigger='colorbox']
directly.
Now if your element is dynamic you would want to use the first one. As this means you don't have to keep rebinding your click event. If your element is static then you want to use the later as it's more efficient.
A third way (or a more efficientway to do the first option) is to bind this to a parent element that is static as opposed to the document
and then filter on the element being clicked, i.e.
$(parent).on("click", "a[data-trigger='colorbox']",function(e){
this is more efficent because it does not need to capture click events on the entire document