Pay attention to them, see how they're moving up and down? Just jump when they're down.
If you can't tell which is why, just pay attention to the state they're in and jump. If you make it, great, keep doing that. If you don't, then jump in the opposite state. EZ.