A drop in blood supply everywhere - including the brain - which causes a sudden loss
of consciousness. Once our head is lower down (eg. on the bathroom floor!) it's easier for blood to get there thanks to gravity, and we regain consciousness.
Since the diarrhea attacks are pretty infrequent, I wouldn't worry too much about them. If I had to hazard a guess, I'd say that there's a clue in what you describe - you pass hard stool first, and then a few minutes later, have diarrhea.