First, look at the two parts, you'll see a jaw on one and a catch on the other.
Look at an assembled hinge to see how they fit together. Engage those two parts, then using the heel of your hand give the assembly a good whack. They should latch back up.
Notice the little lever at the very back of the hinge. If that gets bumped, the parts separate. So go to this web site and buy about 40 of the little plastic guards to clip over that lever.
You'll pay for shipping so don't underestimate how many you need.